2010-10-12 23:28:46 +00:00
|
|
|
include FileUtils
|
2010-01-06 00:36:58 +00:00
|
|
|
|
2010-01-26 19:27:50 +00:00
|
|
|
task :default => [:compile, :test]
|
|
|
|
|
|
2010-01-10 16:58:57 +00:00
|
|
|
desc 'Generate Externs'
|
2010-05-25 21:23:52 +00:00
|
|
|
task :compile_externs do
|
2010-01-10 16:58:57 +00:00
|
|
|
out = File.new("externs.js", "w")
|
|
|
|
|
|
|
|
|
|
out.write("function jQuery(){};\n")
|
2010-03-24 19:08:09 +00:00
|
|
|
file = File.new("lib/jquery/jquery-1.4.2.js", "r")
|
2010-01-10 16:58:57 +00:00
|
|
|
while (line = file.gets)
|
2010-03-24 19:08:09 +00:00
|
|
|
if line =~ /^\s*(\w+)\s*:\s*function.*$/
|
2010-01-10 16:58:57 +00:00
|
|
|
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
|
|
|
|
|
|
2010-05-25 21:23:52 +00:00
|
|
|
desc 'Compile Scenario'
|
|
|
|
|
task :compile_scenario do
|
|
|
|
|
concat = %x(cat \
|
|
|
|
|
lib/jquery/jquery-1.4.2.js \
|
|
|
|
|
src/scenario/angular.prefix \
|
|
|
|
|
src/Angular.js \
|
2010-07-08 22:55:00 +00:00
|
|
|
src/jqLite.js \
|
2010-05-25 21:23:52 +00:00
|
|
|
src/JSON.js \
|
2010-05-27 18:26:23 +00:00
|
|
|
src/Scope.js \
|
Introduced injector and $new to scope, and injection into link methods and controllers
- added angular.injector(scope, services, instanceCache) which returns inject
- inject method can return, instance, or call function which have $inject
property
- initialize services with $creation=[eager|eager-publish] this means that
only some of the services are now globally accessible
- upgraded $become on scope to use injector hence respect the $inject property
for injection
- $become should not be run multiple times and will most likely be removed
in future version
- added $new on scope to create a child scope
- $inject is respected on constructor function
- simplified scopes so that they no longer have separate __proto__ for
parent, api, behavior and instance this should speed up execution since
scope will now create one __proto__ chain per scope (not three).
BACKWARD COMPATIBILITY WARNING:
- services now need to have $inject instead of inject property for proper
injection this breaks backward compatibility
- not all services are now published into root scope
(only: $location, $cookie, $window)
- if you have widget/directive which uses services on scope
(such as this.$xhr), you will now have to inject that service in
(as it is not published on the root scope anymore)
2010-10-09 00:30:13 +00:00
|
|
|
src/Injector.js \
|
2010-05-27 18:26:23 +00:00
|
|
|
src/Parser.js \
|
|
|
|
|
src/Resource.js \
|
|
|
|
|
src/Browser.js \
|
|
|
|
|
src/apis.js \
|
|
|
|
|
src/services.js \
|
|
|
|
|
src/AngularPublic.js \
|
2010-05-25 21:23:52 +00:00
|
|
|
src/scenario/DSL.js \
|
2010-08-05 22:44:54 +00:00
|
|
|
src/scenario/Future.js \
|
|
|
|
|
src/scenario/Matcher.js \
|
|
|
|
|
src/scenario/Runner.js \
|
2010-05-25 21:23:52 +00:00
|
|
|
src/scenario/angular.suffix \
|
|
|
|
|
)
|
|
|
|
|
css = %x(cat css/angular-scenario.css)
|
|
|
|
|
f = File.new("angular-scenario.js", 'w')
|
|
|
|
|
f.write(concat)
|
|
|
|
|
f.write('document.write(\'<style type="text/css">\n')
|
|
|
|
|
f.write(css.gsub(/'/, "\\'").gsub(/\n/, "\\n"));
|
|
|
|
|
f.write('\n</style>\');')
|
|
|
|
|
f.close
|
|
|
|
|
end
|
|
|
|
|
|
2010-01-06 00:36:58 +00:00
|
|
|
desc 'Compile JavaScript'
|
2010-10-12 23:28:46 +00:00
|
|
|
task :compile => [:compile_externs, :compile_scenario] do
|
2010-01-10 16:58:57 +00:00
|
|
|
|
2010-01-09 23:02:43 +00:00
|
|
|
concat = %x(cat \
|
|
|
|
|
src/angular.prefix \
|
2010-01-18 18:47:03 +00:00
|
|
|
src/Angular.js \
|
2010-01-06 00:36:58 +00:00
|
|
|
src/JSON.js \
|
2010-03-29 17:40:57 +00:00
|
|
|
src/Compiler.js \
|
|
|
|
|
src/Scope.js \
|
2010-01-06 00:36:58 +00:00
|
|
|
src/Parser.js \
|
2010-03-16 21:38:56 +00:00
|
|
|
src/Resource.js \
|
2010-04-07 17:17:15 +00:00
|
|
|
src/Browser.js \
|
|
|
|
|
src/jqLite.js \
|
2010-03-29 17:40:57 +00:00
|
|
|
src/apis.js \
|
|
|
|
|
src/filters.js \
|
|
|
|
|
src/formatters.js \
|
|
|
|
|
src/validators.js \
|
2010-05-28 17:32:03 +00:00
|
|
|
src/services.js \
|
2010-03-29 17:40:57 +00:00
|
|
|
src/directives.js \
|
|
|
|
|
src/markups.js \
|
|
|
|
|
src/widgets.js \
|
2010-04-07 17:17:15 +00:00
|
|
|
src/AngularPublic.js \
|
2010-01-09 23:02:43 +00:00
|
|
|
src/angular.suffix \
|
2010-01-06 00:36:58 +00:00
|
|
|
)
|
2010-04-07 17:17:15 +00:00
|
|
|
f = File.new("angular-debug.js", 'w')
|
2010-01-09 23:02:43 +00:00
|
|
|
f.write(concat)
|
2010-01-06 00:36:58 +00:00
|
|
|
f.close
|
|
|
|
|
|
|
|
|
|
%x(java -jar lib/compiler-closure/compiler.jar \
|
2010-08-11 18:17:55 +00:00
|
|
|
--compilation_level SIMPLE_OPTIMIZATIONS \
|
2010-04-07 17:17:15 +00:00
|
|
|
--js angular-debug.js \
|
2010-01-10 16:58:57 +00:00
|
|
|
--externs externs.js \
|
|
|
|
|
--create_source_map ./angular-minified.map \
|
2010-01-09 23:02:43 +00:00
|
|
|
--js_output_file angular-minified.js)
|
2010-01-06 00:36:58 +00:00
|
|
|
end
|
|
|
|
|
|
2010-10-12 23:28:46 +00:00
|
|
|
desc 'Create angular distribution'
|
|
|
|
|
task :package => :compile do
|
|
|
|
|
date = Time.now.strftime('%y%m%d_%H%M')
|
|
|
|
|
sha = %x(git rev-parse HEAD)[0..7]
|
|
|
|
|
filename = "angular-#{date}-#{sha}.tgz"
|
|
|
|
|
|
|
|
|
|
%x(tar -czf #{filename} \
|
|
|
|
|
angular-debug.js \
|
|
|
|
|
angular-minified.js \
|
|
|
|
|
angular-scenario.js \
|
|
|
|
|
css/)
|
|
|
|
|
|
|
|
|
|
puts "Package created: #{filename}"
|
|
|
|
|
end
|
|
|
|
|
|
2010-01-06 00:36:58 +00:00
|
|
|
namespace :server do
|
|
|
|
|
desc 'Run JsTestDriver Server'
|
|
|
|
|
task :start do
|
|
|
|
|
sh %x(java -jar lib/jstestdriver/JsTestDriver.jar --browser open --port 9876)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
desc "Run JavaScript tests against the server"
|
|
|
|
|
task :test do
|
|
|
|
|
sh %(java -jar lib/jstestdriver/JsTestDriver.jar --tests all)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
desc "Run JavaScript tests"
|
|
|
|
|
task :test do
|
|
|
|
|
sh %(java -jar lib/jstestdriver/JsTestDriver.jar --tests all --browser open --port 9876)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
desc 'Lint'
|
|
|
|
|
task :lint do
|
|
|
|
|
out = %x(lib/jsl/jsl -conf lib/jsl/jsl.default.conf)
|
|
|
|
|
print out
|
|
|
|
|
end
|
2010-08-14 18:03:36 +00:00
|
|
|
|
2010-09-22 11:24:40 +00:00
|
|
|
desc 'push_angularjs'
|
2010-08-14 18:03:36 +00:00
|
|
|
task :push_angularjs do
|
|
|
|
|
Rake::Task['compile'].execute 0
|
|
|
|
|
sh %(cat angularjs.ftp | ftp -N angularjs.netrc angularjs.org)
|
|
|
|
|
end
|