Commit 1fd1f630 by Nate Hardison

Wrapper tasks for :assets-dependent Jasmine tasks

The :browse_jasmine_<system> and :phantomjs_jasmine_<system> tasks
depend on the :assets task, which needs to receive both :system and
:env arguments. Therefore, new tasks (:browse_jasmine and
:phantomjs_jasmine) are created that do take :system and :env args.
The old :browse_jasmine_<system> and :phantomjs_jasmine_<system>
tasks now wrap the new tasks, passing in <system> as an argument
and 'jasmine' (for :env, since it's hardcoded to 'jasmine' in
django_for_jasmine()).
parent 35fb5fa4
...@@ -73,21 +73,43 @@ def run_phantom_js(url) ...@@ -73,21 +73,43 @@ def run_phantom_js(url)
sh("#{phantomjs} node_modules/jasmine-reporters/test/phantomjs-testrunner.js #{url}") sh("#{phantomjs} node_modules/jasmine-reporters/test/phantomjs-testrunner.js #{url}")
end end
[:lms, :cms].each do |system| # Open jasmine tests for :system in the default browser. The :env
desc "Open jasmine tests for #{system} in your default browser" # should (always?) be 'jasmine', but it's passed as an arg so that
task "browse_jasmine_#{system}" => :assets do # the :assets dependency gets it.
django_for_jasmine(system, true) do |jasmine_url| #
# This task should be invoked via the wrapper below, so we don't
# include a description to keep it from showing up in rake -T.
task :browse_jasmine, [:system, :env] => :assets do |t, args|
django_for_jasmine(args.system, true) do |jasmine_url|
Launchy.open(jasmine_url) Launchy.open(jasmine_url)
puts "Press ENTER to terminate".red puts "Press ENTER to terminate".red
$stdin.gets $stdin.gets
end end
end end
desc "Use phantomjs to run jasmine tests for #{system} from the console" # Use phantomjs to run jasmine tests from the console. The :env
task "phantomjs_jasmine_#{system}" => :assets do # should (always?) be 'jasmine', but it's passed as an arg so that
django_for_jasmine(system, false) do |jasmine_url| # the :assets dependency gets it.
#
# This task should be invoked via the wrapper below, so we don't
# include a description to keep it from showing up in rake -T.
task :phantomjs_jasmine, [:system, :env] => :assets do |t, args|
django_for_jasmine(args.system, false) do |jasmine_url|
run_phantom_js(jasmine_url) run_phantom_js(jasmine_url)
end end
end
# Wrapper tasks for the real browse_jasmine and phantomjs_jasmine
# tasks above. These have a nicer UI since there's no arg passing.
[:lms, :cms].each do |system|
desc "Open jasmine tests for #{system} in your default browser"
task "browse_jasmine_#{system}" do
task(:browse_jasmine).invoke(system, 'jasmine')
end
desc "Use phantomjs to run jasmine tests for #{system} from the console"
task "phantomjs_jasmine_#{system}" do
task(:phantomjs_jasmine).invoke(system, 'jasmine')
end end
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment