Last active
February 9, 2017 13:53
-
-
Save joshuaruesweg/f9e9896dea0b7c6789f6 to your computer and use it in GitHub Desktop.
WCF Package pack script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export COPYFILE_DISABLE=1 | |
#define package | |
PACKAGE_NAME=${PWD##*/} | |
# build package.xml | |
datum=$(date +"%Y%m%d%H%M") | |
cp package.xml tmp_package.xml | |
## !!!!!!!!!!!!!!!! | |
## use versionnumber instead of the Alpha-Build number! | |
## The script replaces the number automatically. | |
## !!!!!!!!!!!!!!!! | |
sed -e "s/versionnumber/$datum/g" package.xml > tmp.xml | |
rm package.xml | |
cp tmp.xml package.xml | |
rm tmp.xml | |
# build coffeefiles | |
test -e files/js && echo "\nBuild coffee" && cd files/js && coffee --compile --output ./ ./ && cd ../.. | |
test -e files/acp/js && echo "\nBuild coffee for acp" && cd files/acp/js && coffee --compile --output ./ ./ && cd ../../.. | |
# automatic build min js | |
test -e files/js && cd files/js && | |
for i in *.js; do | |
echo "Build minified js for $i : ${i[@]%.js}.min.js" | |
uglifyjs $i --screw-ie8 -m -c --verbose --comments -d production=true -o "${i[@]%.js}.min.js" | |
done && | |
cd ../.. | |
# build package | |
[ -z $PACKAGE_NAME ] && exit 1 | |
test -e acptemplates && echo "\nBuilding acptemplates.tar\n-------------------------" && cd acptemplates && tar cvf ../acptemplates.tar --exclude=".*" -- * && cd .. | |
test -e files && echo "\nBuilding files.tar\n------------------" && cd files && tar cvf ../files.tar --exclude '.git*' --exclude '*.xcf' --exclude '*.coffee' --exclude=".*" -- * && cd .. | |
test -e templates && echo "\nBuilding templates.tar\n----------------------" && cd templates && tar cvf ../templates.tar --exclude=".*" -- * && cd .. | |
test -e acptemplate && echo "\nBuilding acptemplate.tar\n-------------------------" && cd acptemplate && tar cvf ../acptemplate.tar --exclude=".*" -- * && cd .. | |
test -e file && echo "\nBuilding file.tar\n------------------" && cd file && tar cvf ../file.tar --exclude '.git*' --exclude '*.coffee' --exclude=".*" -- * && cd .. | |
test -e template && echo "\nBuilding template.tar\n----------------------" && cd template && tar cvf ../template.tar --exclude=".*" -- * && cd .. | |
test -e wcf_files && echo "\nBuilding wcf_files.tar\n----------------------" && cd wcf_files && tar cvf ../wcf_files.tar --exclude '.git*' --exclude '*.coffee' --exclude=".*" -- * && cd .. | |
echo "\nBuilding $PACKAGE_NAME.tar" | |
tar cvf $PACKAGE_NAME.tar --exclude=".*" --exclude="." --exclude acptemplates --exclude README.md --exclude build.sh --exclude files --exclude wcf_files --exclude templates --exclude acptemplate --exclude '._*' --exclude file --exclude template --exclude nbproject --exclude tmp_package.xml --exclude test -- * | |
test -e acptemplates.tar && rm acptemplates.tar | |
test -e files.tar && rm files.tar | |
test -e templates.tar && rm templates.tar | |
test -e acptemplate.tar && rm acptemplate.tar | |
test -e file.tar && rm file.tar | |
test -e template.tar && rm template.tar | |
# clean up compiled and minified js | |
test -e files/js && cd files/js && | |
for i in *.js; do | |
rm $i | |
done && cd ../.. | |
test -e files/acp/js && cd files/acp/js && | |
for i in *.js; do | |
rm $i | |
done && cd ../../.. | |
# restore version | |
rm package.xml | |
cp tmp_package.xml package.xml | |
rm tmp_package.xml | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment