From 9fd2aeb5efb91734224e48da2bdb72d1a09742d0 Mon Sep 17 00:00:00 2001 From: Tal Rotbart Date: Wed, 23 May 2012 11:11:18 +1000 Subject: [PATCH 1/2] Raise runtime error if jasmine-webkit-specrunner isn't available (command not found) which is caused if the gem hasn't been installed with native extensions. --- lib/jasmine/headless/runner.rb | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/lib/jasmine/headless/runner.rb b/lib/jasmine/headless/runner.rb index 3ce7247..2b21ac9 100644 --- a/lib/jasmine/headless/runner.rb +++ b/lib/jasmine/headless/runner.rb @@ -195,7 +195,9 @@ module Jasmine end end - runner = lambda { system jasmine_command(run_targets) } + runner = lambda { + raise "Error #{$?} while attempting to run '#{jasmine_command(run_targets)}', probably because jasmine-webkit-specrunner hasn't been compiled." if system(jasmine_command(run_targets)) == 127 + } if options[:use_server] wrap_in_server(run_targets, &runner) @@ -205,9 +207,19 @@ module Jasmine @_status = $?.exitstatus ensure - if @_targets && !runner_filename && (@options[:remove_html_file] || (@_status == 0)) - @_targets.each { |target| FileUtils.rm_f target } - end + # if @_targets && !runner_filename && (@options[:remove_html_file] || (@_status == 0)) + # @_targets.each { |target| FileUtils.rm_f target } + # end + end + + def launch_command(cmd) + Open3.popen3(cmd) {|stdin, stdout, stderr, wait_thr| + pid = wait_thr.pid # pid of the started process. + + + + exit_status = wait_thr.value # Process::Status object returned. + } end def absolute_run_targets(targets) -- 2.45.2 From 0d01d5cbb0797d72b0405a1f7a465f2eabd6a2d8 Mon Sep 17 00:00:00 2001 From: Tal Rotbart Date: Fri, 25 May 2012 08:42:20 +1000 Subject: [PATCH 2/2] Removed cruft test code that accidentally remained in runner.rb with the fix to raise a runtime error if jasmine-webkit-specrunner isn't available. --- lib/jasmine/headless/runner.rb | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/lib/jasmine/headless/runner.rb b/lib/jasmine/headless/runner.rb index 2b21ac9..4874061 100644 --- a/lib/jasmine/headless/runner.rb +++ b/lib/jasmine/headless/runner.rb @@ -207,19 +207,9 @@ module Jasmine @_status = $?.exitstatus ensure - # if @_targets && !runner_filename && (@options[:remove_html_file] || (@_status == 0)) - # @_targets.each { |target| FileUtils.rm_f target } - # end - end - - def launch_command(cmd) - Open3.popen3(cmd) {|stdin, stdout, stderr, wait_thr| - pid = wait_thr.pid # pid of the started process. - - - - exit_status = wait_thr.value # Process::Status object returned. - } + if @_targets && !runner_filename && (@options[:remove_html_file] || (@_status == 0)) + @_targets.each { |target| FileUtils.rm_f target } + end end def absolute_run_targets(targets) -- 2.45.2