mirror of
https://github.com/ViViDboarder/docset-sfdc.git
synced 2024-11-21 13:46:32 +00:00
New Archival targets to make it easier to deploy
This commit is contained in:
parent
70ac28bb2f
commit
99e8034f02
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,5 +14,6 @@ syntax-highlighter.min.css
|
||||
# External Go dependencies
|
||||
vendor/
|
||||
build/
|
||||
archive/
|
||||
.DS_Store
|
||||
docset-gen
|
||||
|
42
Makefile
42
Makefile
@ -7,36 +7,44 @@ all: package-apex package-vf package-lightning
|
||||
vendor:
|
||||
dep ensure
|
||||
|
||||
docset-gen: vendor
|
||||
go build -i -x -o docset-gen ./SFDashC/
|
||||
|
||||
.PHONY: run-apex
|
||||
run-apex: clean-index docset-gen
|
||||
./docset-gen apexcode
|
||||
run-apex: clean-index vendor
|
||||
go run ./SFDashC/*.go apexcode
|
||||
|
||||
.PHONY: run-vf
|
||||
run-vf: clean-index docset-gen
|
||||
./docset-gen pages
|
||||
run-vf: clean-index vendor
|
||||
go run ./SFDashC/*.go pages
|
||||
|
||||
.PHONY: run-lightning
|
||||
run-lightning: clean-index docset-gen
|
||||
./docset-gen lightning
|
||||
run-lightning: clean-index vendor
|
||||
go run ./SFDashC/*.go lightning
|
||||
|
||||
.PHONY: package-apex
|
||||
package-apex: run-apex
|
||||
./package-docset.sh Apex
|
||||
./package-docset.sh apexcode
|
||||
|
||||
.PHONY: package-vf
|
||||
package-vf: run-vf
|
||||
./package-docset.sh Pages
|
||||
./package-docset.sh pages
|
||||
|
||||
.PHONY: package-lightning
|
||||
package-lightning: run-lightning
|
||||
./package-docset.sh Lightning
|
||||
./package-docset.sh lightning
|
||||
|
||||
.PHONY: archive
|
||||
archive:
|
||||
find *.docset -depth 0 | xargs -I '{}' sh -c 'tar --exclude=".DS_Store" -czf "$$(echo {} | sed -e "s/\.[^.]*$$//" -e "s/ /_/").tgz" "{}"'
|
||||
@echo "Archives created!"
|
||||
.PHONY: archive-apex
|
||||
archive-apex: package-apex
|
||||
./archive-docset.sh apexcode
|
||||
|
||||
.PHONY: archive-vf
|
||||
archive-vf: package-vf
|
||||
./archive-docset.sh pages
|
||||
|
||||
.PHONY: archive-lightning
|
||||
archive-lightning: package-lightning
|
||||
./archive-docset.sh lightning
|
||||
|
||||
.PHONY: archive-all
|
||||
archive-all: archive-apex archive-vf archive-lightning
|
||||
|
||||
.PHONY: clean-index
|
||||
clean-index:
|
||||
@ -49,10 +57,10 @@ clean-package:
|
||||
.PHONY: clean-archive
|
||||
clean-archive:
|
||||
rm -f *.tgz
|
||||
rm -fr ./archive
|
||||
|
||||
.PHONY: clean
|
||||
clean: clean-index clean-package clean-archive
|
||||
rm -f docset-gen
|
||||
|
||||
.PHONY: clean-build
|
||||
clean-build:
|
||||
|
@ -20,3 +20,4 @@ To Do
|
||||
-----
|
||||
|
||||
- [ ] Now that new `ForceCascadeType` is available, some of the entries in `./SFDashC/supportedtypes.go` can be simplified
|
||||
- [ ] Allow archiving of multiple versions and fetching pre-releases
|
||||
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>Salesforce</string>
|
||||
<!-- Displayed in list view -->
|
||||
<key>CFBundleName</key>
|
||||
<string>Salesforce</string>
|
||||
<key>DocSetPlatformFamily</key>
|
||||
<string>sfdc</string>
|
||||
<key>isDashDocset</key>
|
||||
<true/>
|
||||
<key>dashIndexFilePath</key>
|
||||
<string>index.htm</string>
|
||||
<key>DashDocSetFallbackURL</key>
|
||||
<string>https://developer.salesforce.com/docs/</string>
|
||||
</dict>
|
||||
</plist>
|
@ -167,7 +167,7 @@ func getEntryType(entry TOCEntry, parentType SupportedType) (SupportedType, erro
|
||||
}
|
||||
|
||||
childType, err := lookupEntryType(entry)
|
||||
if err != nil && parentType.CascadeType {
|
||||
if err != nil && parentType.ShouldCascade() {
|
||||
childType = parentType.CreateChildType()
|
||||
err = nil
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ type SupportedType struct {
|
||||
// Should a namspace be prefixed to the database entry
|
||||
ShowNamespace bool
|
||||
// Indicates that this just contains other nodes and we don't want to index this node
|
||||
// This is not hereditary
|
||||
// This type will cascade down one level, but IsContainer itself is not hereditary
|
||||
IsContainer bool
|
||||
// Indicates that this and all nodes underneith should be hidden
|
||||
IsHidden bool
|
||||
@ -127,6 +127,11 @@ func (suppType SupportedType) matchesID(id string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// ShouldCascade returns if this type should be cascaded down to the child
|
||||
func (suppType SupportedType) ShouldCascade() bool {
|
||||
return suppType.ForceCascadeType || suppType.CascadeType || suppType.IsContainer
|
||||
}
|
||||
|
||||
// CreateChildType returns a child type inheriting the current type
|
||||
func (suppType SupportedType) CreateChildType() SupportedType {
|
||||
// Reset values that do not cascade
|
||||
|
58
archive-docset.sh
Executable file
58
archive-docset.sh
Executable file
@ -0,0 +1,58 @@
|
||||
#! /bin/bash
|
||||
set -e
|
||||
|
||||
files_dir=./resources
|
||||
build_dir=./build
|
||||
out_dir=.
|
||||
archive_dir=./archive
|
||||
|
||||
deliverable=$1
|
||||
|
||||
function get_friendly_name {
|
||||
local deliverable=$1
|
||||
local name="$(tr '[:lower:]' '[:upper:]' <<< ${deliverable:0:1})${deliverable:1}"
|
||||
case "$deliverable" in
|
||||
"apexcode")
|
||||
name="Apex"
|
||||
;;
|
||||
"pages")
|
||||
name="Visualforce"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo $name
|
||||
}
|
||||
|
||||
function get_icon_name {
|
||||
local icon="cloud-icon"
|
||||
case "$1" in
|
||||
"lightning")
|
||||
icon="bolt-icon"
|
||||
;;
|
||||
esac
|
||||
echo $icon
|
||||
}
|
||||
|
||||
function main {
|
||||
local name=$(get_friendly_name $deliverable)
|
||||
local package="$out_dir/Salesforce $name.docset"
|
||||
local archive_dir="$archive_dir/Salesforce_$name"
|
||||
local archive="$archive_dir/Salesforce_$name.tgz"
|
||||
local icon=$(get_icon_name $deliverable)
|
||||
mkdir -p $archive_dir
|
||||
|
||||
# Generate docset.json
|
||||
version=$(cat $build_dir/$deliverable-version.txt)
|
||||
cat $files_dir/docset-$deliverable.json | sed s/VERSION/$version/ > $archive_dir/docset.json
|
||||
# Generated tgz archive
|
||||
tar --exclude=".DS_Store" -czf "$archive" "$package"
|
||||
# Copy icons
|
||||
cp "$files_dir/$icon.png" "$archive_dir/icon.png"
|
||||
cp "$files_dir/$icon@2x.png" "$archive_dir/icon@2x.png"
|
||||
# Copy readme
|
||||
cp "$files_dir/Archive_Readme.md" "$archive_dir/README.md"
|
||||
|
||||
echo "Finished archive $archive"
|
||||
}
|
||||
|
||||
main
|
@ -1,24 +1,57 @@
|
||||
#! /bin/bash
|
||||
set -e
|
||||
|
||||
files_dir=./SFDashC
|
||||
files_dir=./resources
|
||||
build_dir=./build
|
||||
out_dir=.
|
||||
|
||||
name=$1
|
||||
deliverable=$(echo $name | tr '[:upper:]' '[:lower:]')
|
||||
if [ "$deliverable" == "apex" ]; then
|
||||
deliverable="apexcode"
|
||||
fi
|
||||
deliverable=$1
|
||||
|
||||
package="Salesforce $name.docset"
|
||||
version=$(cat $build_dir/$deliverable-version.txt)
|
||||
function get-friendly-name {
|
||||
local deliverable=$1
|
||||
local name="$(tr '[:lower:]' '[:upper:]' <<< ${deliverable:0:1})${deliverable:1}"
|
||||
case "$deliverable" in
|
||||
"apexcode")
|
||||
name="Apex"
|
||||
;;
|
||||
"pages")
|
||||
name="Visualforce"
|
||||
;;
|
||||
esac
|
||||
|
||||
cat $files_dir/docset-$deliverable.json | sed s/VERSION/$version/ > $build_dir/docset-$deliverable.json
|
||||
mkdir -p "$package/Contents/Resources/Documents"
|
||||
cp -r $build_dir/atlas.en-us.$deliverable.meta "$package/Contents/Resources/Documents/"
|
||||
cp $build_dir/*.html "$package/Contents/Resources/Documents/"
|
||||
cp $build_dir/*.css "$package/Contents/Resources/Documents/"
|
||||
cp $files_dir/Info-$name.plist "$package/Contents/Info.plist"
|
||||
cp $build_dir/docSet.dsidx "$package/Contents/Resources/"
|
||||
echo $name
|
||||
}
|
||||
|
||||
echo "Finished building $package"
|
||||
function get_icon_name {
|
||||
local icon="cloud-icon"
|
||||
case "$1" in
|
||||
"lightning")
|
||||
icon="bolt-icon"
|
||||
;;
|
||||
esac
|
||||
echo $icon
|
||||
}
|
||||
|
||||
function main {
|
||||
local name=$(get-friendly-name $deliverable)
|
||||
local package="$out_dir/Salesforce $name.docset"
|
||||
local icon=$(get_icon_name $deliverable)
|
||||
mkdir -p "$package/Contents/Resources/Documents"
|
||||
|
||||
# Copy all meta HTML
|
||||
cp -r $build_dir/atlas.en-us.$deliverable.meta "$package/Contents/Resources/Documents/"
|
||||
# Copy HTML and CSS
|
||||
cp $build_dir/$deliverable.html "$package/Contents/Resources/Documents/"
|
||||
cp $build_dir/*.css "$package/Contents/Resources/Documents/"
|
||||
# Copy plsit
|
||||
cp $files_dir/Info-$name.plist "$package/Contents/Info.plist"
|
||||
# Copy index
|
||||
cp $build_dir/docSet.dsidx "$package/Contents/Resources/"
|
||||
# Copy icons
|
||||
cp "$files_dir/$icon.png" "$package/icon.png"
|
||||
cp "$files_dir/$icon@2x.png" "$package/icon@2x.png"
|
||||
|
||||
echo "Finished building $package"
|
||||
}
|
||||
|
||||
main
|
||||
|
13
resources/Archive_Readme.md
Normal file
13
resources/Archive_Readme.md
Normal file
@ -0,0 +1,13 @@
|
||||
Salesforce Apex
|
||||
===============
|
||||
|
||||
Created by [ViViDboarder](https://github.com/ViViDboarder)
|
||||
|
||||
## Generation
|
||||
|
||||
* Clone the repo for [docset-sfdc](https://github.com/ViViDboarder/docset-sfdc)
|
||||
* Run `make` as described in the readme
|
||||
|
||||
## Dependencies
|
||||
|
||||
To avoid redundancy, those are listed on the readme for the other repo
|
BIN
resources/bolt-icon.png
Normal file
BIN
resources/bolt-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
BIN
resources/bolt-icon@2x.png
Normal file
BIN
resources/bolt-icon@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.0 KiB |
BIN
resources/cloud-icon.png
Normal file
BIN
resources/cloud-icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
BIN
resources/cloud-icon@2x.png
Normal file
BIN
resources/cloud-icon@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "Salesforce Visualforce",
|
||||
"version": "VERSION",
|
||||
"archive": "Salesforce_Pages.tgz",
|
||||
"archive": "Salesforce_Visualforce.tgz",
|
||||
"author": {
|
||||
"name": "ViViDboarder",
|
||||
"link": "https://github.com/ViViDboarder"
|
Loading…
Reference in New Issue
Block a user