From 03f02bcf240da2e3b69abfc31cddbd8a1b04f391 Mon Sep 17 00:00:00 2001 From: David Baumgold Date: Thu, 13 Jun 2013 14:57:54 -0400 Subject: [PATCH] Added rake jasmine:cms:browser:watch command --- rakefiles/jasmine.rake | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/rakefiles/jasmine.rake b/rakefiles/jasmine.rake index ab3209c9ec..0f532fdf6f 100644 --- a/rakefiles/jasmine.rake +++ b/rakefiles/jasmine.rake @@ -61,10 +61,10 @@ def template_jasmine_runner(lib) yield File.expand_path(template_output) end -def jasmine_browser(url, wait=10) +def jasmine_browser(url, jitter=3, wait=10) # Jitter starting the browser so that the tests don't all try and # start the browser simultaneously - sleep(rand(3)) + sleep(rand(jitter)) sh("python -m webbrowser -t '#{url}'") sleep(wait) end @@ -87,6 +87,15 @@ end end end + desc "Open jasmine tests for #{system} in your default browser, and dynamically recompile coffeescript" + task :'browser:watch' => :'assets:coffee:_watch' do + django_for_jasmine(system, true) do |jasmine_url| + jasmine_browser(jasmine_url, jitter=0, wait=0) + end + puts "Press ENTER to terminate".red + $stdin.gets + end + desc "Use phantomjs to run jasmine tests for #{system} from the console" task :phantomjs do Rake::Task[:assets].invoke(system, 'jasmine')