Re-implemented all development Rake tasks in Thor. Now actually tested.
Fixes: * https://www.pivotaltracker.com/story/show/25484287 & https://github.com/pivotal/jasmine/issues/183 * https://www.pivotaltracker.com/story/show/25485401 & https://github.com/pivotal/jasmine/issues/189 * https://www.pivotaltracker.com/story/show/25485953 & https://github.com/pivotal/jasmine/issues/159
This commit is contained in:
52
tasks/jasmine_dev/execute_specs.rb
Normal file
52
tasks/jasmine_dev/execute_specs.rb
Normal file
@@ -0,0 +1,52 @@
|
||||
class JasmineDev < Thor
|
||||
|
||||
desc "execute_specs_in_node", "Run all relevant specs in Node.js"
|
||||
|
||||
def execute_specs_in_node
|
||||
return unless node_installed?
|
||||
|
||||
invoke :build_distribution
|
||||
invoke :count_specs
|
||||
|
||||
say JasmineDev.spacer
|
||||
|
||||
say "Running all appropriate specs via Node.js...", :cyan
|
||||
|
||||
with_color_option = Term::ANSIColor.coloring? ? "--color" : "--noColor"
|
||||
|
||||
run_with_output "node spec/node_suite.js #{with_color_option}", :capture => true
|
||||
end
|
||||
|
||||
desc "execute_specs_in_browser", "Run all relevent specs in your default browser"
|
||||
|
||||
def execute_specs_in_browser
|
||||
invoke :build_distribution
|
||||
invoke :count_specs
|
||||
|
||||
say JasmineDev.spacer
|
||||
|
||||
say "Running all appropriate specs via the default web browser...", :cyan
|
||||
|
||||
open_specs_in_browser
|
||||
end
|
||||
|
||||
desc "execute_specs", "Run all of Jasmine's specs"
|
||||
|
||||
def execute_specs
|
||||
invoke :execute_specs_in_node
|
||||
invoke :execute_specs_in_browser
|
||||
end
|
||||
|
||||
no_tasks do
|
||||
def open_specs_in_browser
|
||||
require 'rbconfig'
|
||||
|
||||
case Object.const_get(defined?(RbConfig) ? :RbConfig : :Config)::CONFIG['host_os']
|
||||
when /linux/
|
||||
run "xdg-open spec/runner.html"
|
||||
else
|
||||
run "open spec/runner.html"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user