Simpler packaging

This commit is contained in:
ViViDboarder 2018-01-05 12:50:13 -08:00
parent be9e0b853e
commit 6f8135ce6b
3 changed files with 59 additions and 60 deletions

1
.gitignore vendored
View File

@ -15,3 +15,4 @@ syntax-highlighter.min.css
vendor/ vendor/
build/ build/
.DS_Store .DS_Store
docset-gen

View File

@ -1,83 +1,57 @@
.PHONY: all clean-index package-apex clean-index package-vf clean-index package-combined .PHONY: default
default: all default: all
all: clean-index package-apex clean-index package-vf clean-index package-lightning clean-index package-combined .PHONY: all
all: package-apex package-vf package-lightning
run-apex: clean-index docset-gen:
dep ensure dep ensure
go run ./SFDashC/*.go apexcode go build -x -o docset-gen ./SFDashC/
run-vf: clean-index .PHONY: run-apex
dep ensure run-apex: clean-index docset-gen
go run ./SFDashC/*.go pages ./docset-gen apexcode
run-lightning: clean-index .PHONY: run-vf
dep ensure run-vf: clean-index docset-gen
go run ./SFDashC/*.go -debug lightning ./docset-gen pages
run-combined: clean-index .PHONY: run-lightning
dep ensure run-lightning: clean-index docset-gen
go run ./SFDashC/*.go apexcode pages lightning ./docset-gen lightning
package-apex: run-apex package-apex: run-apex
$(eval name = Apex) ./package-docset.sh Apex
$(eval package = Salesforce $(name).docset)
$(eval version = $(shell cat ./build/apexcode-version.txt))
cat ./SFDashC/docset-apexcode.json | sed s/VERSION/$(version)/ > ./build/docset-apexcode.json
mkdir -p "$(package)/Contents/Resources/Documents"
cp -r ./build/atlas.en-us.apexcode.meta "$(package)/Contents/Resources/Documents/"
cp ./build/*.html "$(package)/Contents/Resources/Documents/"
cp ./build/*.css "$(package)/Contents/Resources/Documents/"
cp ./SFDashC/Info-$(name).plist "$(package)/Contents/Info.plist"
cp ./build/docSet.dsidx "$(package)/Contents/Resources/"
@echo "Docset generated!"
.PHONY: package-vf
package-vf: run-vf package-vf: run-vf
$(eval name = Pages) ./package-docset.sh Pages
$(eval package = Salesforce $(name).docset)
$(eval version = $(shell cat ./build/pages-version.txt))
cat ./SFDashC/docset-pages.json | sed s/VERSION/$(version)/ > ./build/docset-pages.json
mkdir -p "$(package)/Contents/Resources/Documents"
cp -r ./build/atlas.en-us.pages.meta "$(package)/Contents/Resources/Documents/"
cp ./build/*.html "$(package)/Contents/Resources/Documents/"
cp ./build/*.css "$(package)/Contents/Resources/Documents/"
cp ./SFDashC/Info-$(name).plist "$(package)/Contents/Info.plist"
cp ./build/docSet.dsidx "$(package)/Contents/Resources/"
@echo "Docset generated!"
.PHONY: package-lightning
package-lightning: run-lightning package-lightning: run-lightning
$(eval name = Lightning) ./package-docset.sh Lightning
$(eval package = Salesforce $(name).docset)
$(eval version = $(shell cat ./build/lightning-version.txt))
cat ./SFDashC/docset-lightning.json | sed s/VERSION/$(version)/ > ./build/docset-lightning.json
mkdir -p "$(package)/Contents/Resources/Documents"
cp -r ./build/atlas.en-us.lightning.meta "$(package)/Contents/Resources/Documents/"
cp ./build/*.html "$(package)/Contents/Resources/Documents/"
cp ./build/*.css "$(package)/Contents/Resources/Documents/"
cp ./SFDashC/Info-$(name).plist "$(package)/Contents/Info.plist"
cp ./build/docSet.dsidx "$(package)/Contents/Resources/"
@echo "Docset generated!"
package-combined: run-combined
$(eval name = Combined)
$(eval package = Salesforce $(name).docset)
mkdir -p "$(package)/Contents/Resources/Documents"
cp -r ./build/*.meta "$(package)/Contents/Resources/Documents/"
cp ./build/*.html "$(package)/Contents/Resources/Documents/"
cp ./build/*.css "$(package)/Contents/Resources/Documents/"
cp ./SFDashC/Info-$(name).plist "$(package)/Contents/Info.plist"
cp ./build/docSet.dsidx "$(package)/Contents/Resources/"
@echo "Docset generated!"
.PHONY: archive
archive: archive:
find *.docset -depth 0 | xargs -I '{}' sh -c 'tar --exclude=".DS_Store" -czf "$$(echo {} | sed -e "s/\.[^.]*$$//" -e "s/ /_/").tgz" "{}"' find *.docset -depth 0 | xargs -I '{}' sh -c 'tar --exclude=".DS_Store" -czf "$$(echo {} | sed -e "s/\.[^.]*$$//" -e "s/ /_/").tgz" "{}"'
@echo "Archives created!" @echo "Archives created!"
.PHONY: clean-index
clean-index: clean-index:
rm -f ./build/docSet.dsidx rm -f ./build/docSet.dsidx
clean: clean-index .PHONY: clean-package
rm -fr ./build clean-package:
rm -fr *.docset rm -fr *.docset
.PHONY: clean-archive
clean-archive:
rm -f *.tgz rm -f *.tgz
.PHONY: clean
clean: clean-index clean-package clean-archive
rm -f docset-gen
.PHONY: clean-build
clean-build:
rm -fr ./build

24
package-docset.sh Executable file
View File

@ -0,0 +1,24 @@
#! /bin/bash
set -e
files_dir=./SFDashC
build_dir=./build
name=$1
deliverable=$(echo $name | tr '[:upper:]' '[:lower:]')
if [ "$deliverable" == "apex" ]; then
deliverable="apexcode"
fi
package="Salesforce $name.docset"
version=$(cat $build_dir/$deliverable-version.txt)
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 "Finished building $package"