Class: Shenandoah::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/shenandoah/runner.rb

Instance Method Summary collapse

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, options = {})
  @locator = locator
  @quiet = options[: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_shellObject



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