11include FileUtils
22
3+ desc 'Generate Externs'
4+ task :compileexterns do
5+ out = File . new ( "externs.js" , "w" )
6+
7+ out . write ( "function _(){};\n " )
8+ file = File . new ( "lib/underscore/underscore.js" , "r" )
9+ while ( line = file . gets )
10+ if line =~ /^\s *_\. (\w +)\s *=.*$/
11+ out . write ( "_.#{ $1} =function(){};\n " )
12+ end
13+ end
14+ file . close
15+
16+ out . write ( "function jQuery(){};\n " )
17+ file = File . new ( "lib/jquery/jquery-1.3.2.js" , "r" )
18+ while ( line = file . gets )
19+ if line =~ /^\s *(\w +)\s *:\s *function.*$/
20+ out . write ( "jQuery.#{ $1} =function(){};\n " )
21+ end
22+ end
23+ file . close
24+ out . write ( "jQuery.scope=function(){};\n " )
25+ out . write ( "jQuery.controller=function(){};\n " )
26+
27+ out . close
28+ end
29+
330desc 'Compile JavaScript'
431task :compile do
32+ Rake ::Task [ 'compileexterns' ] . execute
33+
534 concat = %x(cat \
6- lib/underscore/underscore.js \
735 src/angular.prefix \
836 lib/webtoolkit/webtoolkit.base64.js \
9- lib/swfobject.js/swfobject.js \
1037 src/Loader.js \
1138 src/API.js \
1239 src/Binder.js \
@@ -30,6 +57,8 @@ task :compile do
3057 %x(java -jar lib/compiler-closure/compiler.jar \
3158 --compilation_level ADVANCED_OPTIMIZATIONS \
3259 --js angular.js \
60+ --externs externs.js \
61+ --create_source_map ./angular-minified.map \
3362 --js_output_file angular-minified.js)
3463end
3564
0 commit comments