From 1aba6b53b88c70b61a0cc991b1371739305d117b Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Sun, 10 Jan 2010 08:58:57 -0800 Subject: basic calculator works with minified.js, lots of references still broken --- Rakefile | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'Rakefile') 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 -- cgit v1.2.3