Class: Shenandoah::Runner
- Inherits:
-
Object
- Object
- Shenandoah::Runner
- Defined in:
- lib/shenandoah/runner.rb
Instance Method Summary collapse
-
#initialize(locator, options = {}) ⇒ Runner
constructor
A new instance of Runner.
-
#run_console(specs) ⇒ Object
Runs the specified specs.
- #run_shell ⇒ Object
Constructor Details
#initialize(locator, options = {}) ⇒ Runner
Returns a new instance of Runner.
6 7 8 9 |
# File 'lib/shenandoah/runner.rb', line 6 def initialize(locator, = {}) @locator = locator @quiet = [:quiet] end |
Instance Method Details
#run_console(specs) ⇒ Object
Runs the specified specs. Returns an array of the specs that passed.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/shenandoah/runner.rb', line 12 def run_console(specs) FileUtils.cd @locator.spec_path do runner_cmd = rhino_command(shen_path_to('lib/shenandoah/javascript/console/runner.js')) args = [ shen_path_to, @locator.main_path, @locator.spec_path ] return specs.select { |spec| system("#{runner_cmd} '#{args.join("' '")}' '#{spec.sub(%r{^#{@locator.spec_path}/}, '')}' #{@quiet ? '> /dev/null' : ''}") } end end |
#run_shell ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/shenandoah/runner.rb', line 27 def run_shell create_shell_html create_shell_js rlwrap = `which rlwrap`.chomp.sub(/^no.*/, '') # some versions of which report errors on stdout cmd = "#{rlwrap} #{rhino_command('-f', shell_js_path, '-f', '-')}" $stderr.puts "Starting shell with #{cmd}" system(cmd) end |