From 2ead8be0d4e4349270df116d41d6957dbb7346bf Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Sat, 18 Apr 2009 16:11:18 +0000 Subject: [PATCH] script to combine and compress the deluge javascript --- deluge/ui/web/js/build.sh | 50 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 deluge/ui/web/js/build.sh diff --git a/deluge/ui/web/js/build.sh b/deluge/ui/web/js/build.sh new file mode 100755 index 000000000..e5c44250b --- /dev/null +++ b/deluge/ui/web/js/build.sh @@ -0,0 +1,50 @@ +DELUGE_FILES="rpc.js deluge.js deluge-ext.js deluge-login.js deluge-menus.js deluge-bars.js deluge-connections.js deluge-torrents.js deluge-details.js deluge-add.js deluge-preferences.js deluge-ui.js" +ALL_FILES="ext-extensions-debug.js $DELUGE_FILES" + +scan() { + cat /dev/null > .build_data.tmp + for FILE in $ALL_FILES; do + md5sum $FILE >> .build_data.tmp + done; +} + +check_file() { + FILE=$1 + LAST_BUILD=`grep $FILE .build_data` + if [ $? == 1 ]; then return 1; fi; + + CURRENT=`grep $FILE .build_data.tmp` + + [ "$CURRENT" != "$LAST_BUILD" ] && return 1 + + return 0; +} + +build_deluge() { + NEEDS_BUILD=false; + for FILE in $DELUGE_FILES; do + check_file $FILE + [ $? == 1 ] && NEEDS_BUILD=true + done; + + [ $NEEDS_BUILD == false ] && return 0 + + echo "Building deluge-yc.js" + cat $ALL_FILES > deluge-yc.js.tmp + yuicompressor --type=js -o "deluge-yc.js" "deluge-yc.js.tmp" + rm "deluge-yc.js.tmp" +} + +build_ext() { + check_file "ext-extensions-debug.js" + if [ $? == 1 ]; then + echo "Building ext-extensions.js" + yuicompressor --type=js -o "ext-extensions.js" "ext-extensions-debug.js" + fi; +} + +scan +build_ext +build_deluge + +mv .build_data.tmp .build_data