aboutsummaryrefslogtreecommitdiffstats
path: root/Rakefile
diff options
context:
space:
mode:
authorMisko Hevery2010-01-10 08:58:57 -0800
committerMisko Hevery2010-01-10 08:58:57 -0800
commit1aba6b53b88c70b61a0cc991b1371739305d117b (patch)
treed1d21efbd2df191824b7a02020190df0195f2fbb /Rakefile
parent9b9a0dadcce82ae42ac09ad396d647739af20a06 (diff)
downloadangular.js-1aba6b53b88c70b61a0cc991b1371739305d117b.tar.bz2
basic calculator works with minified.js, lots of references still broken
Diffstat (limited to 'Rakefile')
-rw-r--r--Rakefile33
1 files changed, 31 insertions, 2 deletions
diff --git a/Rakefile b/Rakefile
index a4823809..8f7bc7ec 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,12 +1,39 @@
include FileUtils
+desc 'Generate Externs'
+task :compileexterns do
+ out = File.new("externs.js", "w")
+
+ out.write("function _(){};\n")
+ file = File.new("lib/underscore/underscore.js", "r")
+ while (line = file.gets)
+ if line =~ /^\s*_\.(\w+)\s*=.*$/
+ out.write("_.#{$1}=function(){};\n")
+ end
+ end
+ file.close
+
+ out.write("function jQuery(){};\n")
+ file = File.new("lib/jquery/jquery-1.3.2.js", "r")
+ while (line = file.gets)
+ if line =~ /^\s*(\w+)\s*:\s*function.*$/
+ out.write("jQuery.#{$1}=function(){};\n")
+ end
+ end
+ file.close
+ out.write("jQuery.scope=function(){};\n")
+ out.write("jQuery.controller=function(){};\n")
+
+ out.close
+end
+
desc 'Compile JavaScript'
task :compile do
+ Rake::Task['compileexterns'].execute
+
concat = %x(cat \
- lib/underscore/underscore.js \
src/angular.prefix \
lib/webtoolkit/webtoolkit.base64.js \
- lib/swfobject.js/swfobject.js \
src/Loader.js \
src/API.js \
src/Binder.js \
@@ -30,6 +57,8 @@ task :compile do
%x(java -jar lib/compiler-closure/compiler.jar \
--compilation_level ADVANCED_OPTIMIZATIONS \
--js angular.js \
+ --externs externs.js \
+ --create_source_map ./angular-minified.map \
--js_output_file angular-minified.js)
end