mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 23:10:17 +00:00
27 lines
1.2 KiB
Bash
27 lines
1.2 KiB
Bash
#!/bin/sh
|
|
|
|
# make build directory and copy original files there for preflighting
|
|
rm -rf build
|
|
mkdir build
|
|
cp *.html *.py *.txt .htaccess *.js *.css build/
|
|
|
|
# replace local jquery reference with Google API loader
|
|
sed -i -e "s|jquery\.js|http://www.google.com/jsapi|g" build/*.html
|
|
sed -i -e "s|//google\.|google.|g" build/dip3.js
|
|
sed -i -e "s|//}.; /\* google\..*|});|g" build/dip3.js
|
|
|
|
# minimize JS and CSS
|
|
revision=`hg log|grep changeset|cut -d":" -f3|head -1`
|
|
java -jar yuicompressor-2.4.2.jar build/dip3.js > build/dip3.$revision.min.js
|
|
java -jar yuicompressor-2.4.2.jar build/dip3.css > build/dip3.$revision.min.css
|
|
sed -i -e "s|dip3\.js|http://wearehugh.com/dip3/dip3.${revision}.min.js|g" build/*.html
|
|
sed -i -e "s|dip3\.css|http://wearehugh.com/dip3/dip3.${revision}.min.css|g" build/*.html
|
|
sed -i -e "s|html5\.js|http://wearehugh.com/dip3/html5.js|g" build/*.html
|
|
|
|
# set file permissions for public consumption
|
|
chmod 644 build/*.html build/*.css build/*.js build/*.py build/*.txt build/.htaccess
|
|
|
|
# and push to production
|
|
rsync -essh -avzP --delete --delete-after build/*.min.css build/*.min.js build/html5.js diveintomark.org:~/web/wearehugh.com/dip3/
|
|
rsync -essh -avzP build/*.html build/*.py build/*.txt build/.htaccess diveintomark.org:~/web/diveintopython3.org/
|