diff --git a/Gemfile b/Gemfile index ee7c783..b792040 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,7 @@ source 'https://rubygems.org' gemspec -gem 'cucumber', '~> 1.0.0' -gem 'rspec', '~> 2.8' +gem 'cucumber', '~>1.3.2' +gem 'rspec', '~>2.13.0' gem 'rake' gem "spork", :path => File.expand_path("../", __FILE__) diff --git a/Gemfile.lock b/Gemfile.lock index 6072489..6a039ae 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,41 +6,39 @@ PATH GEM remote: https://rubygems.org/ specs: - builder (3.0.0) + builder (3.2.2) columnize (0.3.6) - cucumber (1.0.6) + cucumber (1.3.2) builder (>= 2.1.2) - diff-lcs (>= 1.1.2) - gherkin (~> 2.4.18) - json (>= 1.4.6) - term-ansicolor (>= 1.0.6) + diff-lcs (>= 1.1.3) + gherkin (~> 2.12.0) + multi_json (~> 1.3) debugger (1.6.0) columnize (>= 0.3.1) debugger-linecache (~> 1.2.0) debugger-ruby_core_source (~> 1.2.1) debugger-linecache (1.2.0) debugger-ruby_core_source (1.2.3) - diff-lcs (1.1.3) - gherkin (2.4.21) - json (>= 1.4.6) - json (1.6.5) - rake (0.9.2.2) - rspec (2.8.0) - rspec-core (~> 2.8.0) - rspec-expectations (~> 2.8.0) - rspec-mocks (~> 2.8.0) - rspec-core (2.8.0) - rspec-expectations (2.8.0) - diff-lcs (~> 1.1.2) - rspec-mocks (2.8.0) - term-ansicolor (1.0.7) + diff-lcs (1.2.4) + gherkin (2.12.0) + multi_json (~> 1.3) + multi_json (1.7.7) + rake (10.1.0) + rspec (2.13.0) + rspec-core (~> 2.13.0) + rspec-expectations (~> 2.13.0) + rspec-mocks (~> 2.13.0) + rspec-core (2.13.1) + rspec-expectations (2.13.0) + diff-lcs (>= 1.1.3, < 2.0) + rspec-mocks (2.13.1) PLATFORMS ruby DEPENDENCIES - cucumber (~> 1.0.0) + cucumber (~> 1.3.2) debugger rake - rspec (~> 2.8) + rspec (~> 2.13.0) spork! diff --git a/features/support/spork_world.rb b/features/support/spork_world.rb index b602467..6f1e5fa 100644 --- a/features/support/spork_world.rb +++ b/features/support/spork_world.rb @@ -53,10 +53,14 @@ def run(command) stderr_file = Tempfile.new('spork') stderr_file.close in_current_dir do - gemfile = ENV['BUNDLE_GEMFILE'] - Bundler.with_clean_env do - ENV['BUNDLE_GEMFILE'] = gemfile + if command.start_with?("rails new") @last_stdout = `bundle exec #{command} 2> #{stderr_file.path}` + else + gemfile = ENV['BUNDLE_GEMFILE'] + Bundler.with_clean_env do + ENV['BUNDLE_GEMFILE'] = gemfile + @last_stdout = `bundle exec #{command} 2> #{stderr_file.path}` + end end @last_exit_status = $?.exitstatus end diff --git a/lib/spork/forker.rb b/lib/spork/forker.rb index 2d7734a..11c0cd5 100644 --- a/lib/spork/forker.rb +++ b/lib/spork/forker.rb @@ -6,10 +6,10 @@ # sleep 3 # "success" # end -# +# # forker.result # => "success" class Spork::Forker - + # Raised if the fork died (was killed) before it sent it's response back. class ForkDiedException < Exception; end def initialize(&block) @@ -23,16 +23,18 @@ def initialize(&block) master_response = Marshal.load(@child_io) rescue EOFError nil + rescue SystemExit => e + puts "Error: exit code #{e.status}" unless e.status == 0 rescue Exception => e puts "Exception encountered: #{e.inspect}\nbacktrace:\n#{e.backtrace * %(\n)}" end - + # terminate, skipping any at_exit blocks. exit!(0) end @child_io.close end - + # Wait for the fork to finish running, and then return its return value. # # If the fork was aborted, then result returns nil. @@ -52,7 +54,7 @@ def result @child_pid = nil @result end - + # abort the current running fork def abort if running? @@ -61,7 +63,7 @@ def abort true end end - + def running? return false unless @child_pid Process.getpgid(@child_pid)