script to combine and compress the deluge javascript

This commit is contained in:
Damien Churchill 2009-04-18 16:11:18 +00:00
parent e5459eda49
commit 2ead8be0d4
1 changed files with 50 additions and 0 deletions

50
deluge/ui/web/js/build.sh Executable file
View File

@ -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