Skip to content
Browse files

adding some initial scripts

  • Loading branch information...
1 parent 60a510c commit cb11855406c6043c1b6f89587b200d6f22469c5a @abedra abedra committed Jun 10, 2011
Showing with 51 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +16 −0 script/bootstrap
  3. +4 −0 script/clean
  4. +30 −0 script/test-compile
View
1 .gitignore
@@ -2,3 +2,4 @@
.idea
/.DS_Store
/classes
+closure
View
16 script/bootstrap
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+echo "Fetching Google Closure Library..."
+mkdir -p closure/library
+cd closure/library
+curl -O -s http://closure-library.googlecode.com/files/closure-library-20110323-r790.zip
+unzip -q closure-library-20110323-r790.zip
+rm closure-library-20110323-r790.zip
+cd ..
+echo "Fetching Google Closure Compiler..."
+mkdir compiler
+cd compiler
+curl -O -s http://closure-compiler.googlecode.com/files/compiler-latest.zip
+unzip -q compiler-latest.zip
+rm compiler-latest.zip
+cd ../..
View
4 script/clean
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+rm -rf closure
+rm -rf compilation
View
30 script/test-compile
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+echo "Generating sample javascript"
+mkdir compilation
+
+cat <<EOF > compilation/test.js
+function create_alert(msg) {
+ alert(msg);
+}
+EOF
+
+echo "Testing compilation"
+cd compilation
+for file in *
+do
+ if [ -f $file ] ; then
+ name=${file%\.*}
+ java -jar ../closure/compiler/compiler.jar --js $file --js_output_file $name-compiled.js
+ fi
+done
+cd ..
+
+echo "\nOriginal:"
+cat compilation/test.js
+
+echo "\nOptimized:"
+cat compilation/test-compiled.js
+
+echo "\nCleaning up"
+rm -rf compilation

0 comments on commit cb11855

Please sign in to comment.
Something went wrong with that request. Please try again.