2 JS_DIR=`dirname "$0"`/../program/js
3 CLOSURE_COMPILER_URL='http://closure-compiler.googlecode.com/files/compiler-latest.zip'
7 java -jar compiler.jar --compilation_level=SIMPLE_OPTIMIZATIONS --js="$1" --js_output_file="$2"
10 if [ ! -d "$JS_DIR" ]; then
11 echo "Directory $JS_DIR not found."
15 if java -version >/dev/null 2>&1; then
18 echo "Java not found. Please ensure that the 'java' program is in your PATH."
22 if [ ! -r "compiler.jar" ]; then
23 if which wget >/dev/null 2>&1 && which unzip >/dev/null 2>&1; then
24 wget "$CLOSURE_COMPILER_URL" -O "/tmp/$$.zip"
25 elif which curl >/dev/null 2>&1 && which unzip >/dev/null 2>&1; then
26 curl "$CLOSURE_COMPILER_URL" -o "/tmp/$$.zip"
28 echo "Please download $CLOSURE_COMPILER_URL and extract compiler.jar to this directory."
31 unzip "/tmp/$$.zip" "compiler.jar"
35 for fn in app common googiespell list; do
36 if [ -r "$JS_DIR/${fn}.js.src" ]; then
37 echo "$JS_DIR/${fn}.js.src already exists, not overwriting"
39 mv "$JS_DIR/${fn}.js" "$JS_DIR/${fn}.js.src"
41 echo "Shrinking $JS_DIR/${fn}.js"
42 do_shrink "$JS_DIR/${fn}.js.src" "$JS_DIR/${fn}.js"
45 for fn in tiny_mce/tiny_mce; do
46 echo "Shrinking $JS_DIR/${fn}.js"
47 do_shrink "$JS_DIR/${fn}_src.js" "$JS_DIR/${fn}.js"