[MapQuery] Build scripts

Steven M. Ottens steven at minst.net
Thu Sep 29 05:52:46 EDT 2011


Hi all,

I promised at the codesprint to publish the build scripts as used for 
auto building the site with jenkins.
There are two scripts, the build script gets triggered after a push to 
the mapquery git repository:

#!/bin/bash
#set the different paths
SRC=/var/lib/jenkins/jobs/mapquery/workspace

#clear old dependencies
cp -f ${SRC}/lib/getdeps.sh /tmp/
rm -rf ${SRC}/lib/*
mv /tmp/getdeps.sh ${SRC}/lib/

#get the latest dependencies
cd ${SRC}/lib/
sh getdeps.sh

#run the jslint on the javascript files
cd ${SRC}/tests/
chmod +x jslint.sh
sh jslint.sh

If this script succeeds it will trigger the build-site script which 
builds the actual site:

#!/bin/bash
#set the different paths
SRC=/var/lib/jenkins/jobs/mapquery/workspace
SITE=/var/lib/jenkins/jobs/build-mq-site/workspace

#get the latest site from git (in case someone else pushed changes to 
the site)
cd ${SITE}
git checkout master
git pull

#copy the output from the build script
cp -fr ${SRC}/tests ${SITE}/.
cp -fr ${SRC}/demo ${SITE}/.
cp -fr ${SRC}/lib ${SITE}/.
cp -fr ${SRC}/src ${SITE}/.
cp -rf ${SITE}/build/demo-index.html ${SITE}/demo/index.html

#build the documentation (using https://github.com/stvno/jodoc-js )
cd ${SRC}/src/
node /home/mapquery/jodoc-js/jodoc.js --output ${SITE}/docs/ *.js 
--template ${SITE}/build/template.html --maintext ${SITE}/build/main.md
mv ${SITE}/docs/_index.html ${SITE}/docs/index.html

#create a single minified javascript file using uglify.js
files="$(ls jquery.mapquery.core.js; ls -I 'jquery.mapquery.mq*' -I 
'jquery.mapquery.core.js'; ls jquery.mapquery.mq* )"
rm /tmp/file.js
cat $files >> /tmp/file.js
echo $files
uglifyjs -o ${SITE}/jquery.mapquery.js /tmp/file.js

#commit the changes and push to gihub
cd ${SITE}
git add .
git commit -a -m 'Auto build '${BUILD_NUMBER}
git push

If you have any questions or suggestions for improvement let me know

Steven



More information about the MapQuery mailing list