From 6f8135ce6b0a5779fbfee51c311ce1e461a43df1 Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Fri, 5 Jan 2018 12:50:13 -0800 Subject: [PATCH] Simpler packaging --- .gitignore | 1 + Makefile | 94 +++++++++++++++++------------------------------ package-docset.sh | 24 ++++++++++++ 3 files changed, 59 insertions(+), 60 deletions(-) create mode 100755 package-docset.sh diff --git a/.gitignore b/.gitignore index 7d641e7..23dc435 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ syntax-highlighter.min.css vendor/ build/ .DS_Store +docset-gen diff --git a/Makefile b/Makefile index 3d99076..e2d64a3 100644 --- a/Makefile +++ b/Makefile @@ -1,83 +1,57 @@ -.PHONY: all clean-index package-apex clean-index package-vf clean-index package-combined - +.PHONY: default 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 - go run ./SFDashC/*.go apexcode + go build -x -o docset-gen ./SFDashC/ -run-vf: clean-index - dep ensure - go run ./SFDashC/*.go pages +.PHONY: run-apex +run-apex: clean-index docset-gen + ./docset-gen apexcode -run-lightning: clean-index - dep ensure - go run ./SFDashC/*.go -debug lightning +.PHONY: run-vf +run-vf: clean-index docset-gen + ./docset-gen pages -run-combined: clean-index - dep ensure - go run ./SFDashC/*.go apexcode pages lightning +.PHONY: run-lightning +run-lightning: clean-index docset-gen + ./docset-gen lightning package-apex: run-apex - $(eval name = 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!" + ./package-docset.sh Apex +.PHONY: package-vf package-vf: run-vf - $(eval name = 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!" + ./package-docset.sh Pages +.PHONY: package-lightning package-lightning: run-lightning - $(eval name = 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!" + ./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: clean-index clean-index: rm -f ./build/docSet.dsidx -clean: clean-index - rm -fr ./build +.PHONY: clean-package +clean-package: rm -fr *.docset + +.PHONY: clean-archive +clean-archive: rm -f *.tgz + +.PHONY: clean +clean: clean-index clean-package clean-archive + rm -f docset-gen + +.PHONY: clean-build +clean-build: + rm -fr ./build diff --git a/package-docset.sh b/package-docset.sh new file mode 100755 index 0000000..ffd381c --- /dev/null +++ b/package-docset.sh @@ -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"