spork 0.7.6 → 0.7.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -15,7 +15,8 @@ Feature: At exit during each run
15
15
 
16
16
  Spork.each_run do
17
17
  puts "running"
18
- at_exit { puts "each_run at_exit called" }
18
+ at_exit { printf "first " }
19
+ at_exit { printf "second " }
19
20
  end
20
21
 
21
22
  """
@@ -30,5 +31,5 @@ Feature: At exit during each run
30
31
  """
31
32
  When I fire up a spork instance with "spork rspec"
32
33
  And I run spec --drb spec/did_it_work_spec.rb
33
- Then the output should contain "each_run at_exit called"
34
+ Then the output should contain "second first"
34
35
  Then the output should not contain "prefork at_exit called"
@@ -77,8 +77,9 @@ module Spork
77
77
 
78
78
  # Used by the server. Called to run all of the after_each_run blocks.
79
79
  def exec_after_each_run
80
- after_each_run_procs.each { |p| p.call }
81
- after_each_run_procs.clear
80
+ # processes in reverse order similar to at_exit
81
+ while p = after_each_run_procs.pop; p.call; end
82
+ true
82
83
  end
83
84
 
84
85
  # Traps an instance method of a class (or module) so any calls to it don't actually run until Spork.exec_each_run
@@ -5,6 +5,10 @@ class ::ApplicationController < ActionController::Base
5
5
  def inherited(klass)
6
6
  (@_descendants ||= []) << klass if @@preloading
7
7
  super
8
+ Spork.each_run do
9
+ klass.master_helper_module.send(:include, master_helper_module)
10
+ klass.send(:default_helper_module!)
11
+ end
8
12
  end
9
13
 
10
14
  def reapply_inheritance!
@@ -16,15 +16,16 @@ class Spork::Forker
16
16
  return unless block_given?
17
17
  @child_io, @server_io = UNIXSocket.socketpair
18
18
  @child_pid = Kernel.fork do
19
- @server_io.close
20
- Marshal.dump(yield, @child_io)
21
- # wait for the parent to acknowledge receipt of the result.
22
- master_response =
23
- begin
24
- Marshal.load(@child_io)
25
- rescue EOFError
26
- nil
27
- end
19
+ begin
20
+ @server_io.close
21
+ Marshal.dump(yield, @child_io)
22
+ # wait for the parent to acknowledge receipt of the result.
23
+ master_response = Marshal.load(@child_io)
24
+ rescue EOFError
25
+ nil
26
+ rescue Exception => e
27
+ puts "Exception encountered: #{e.inspect}\nbacktrace:\n#{e.backtrace * %(\n)}"
28
+ end
28
29
 
29
30
  # terminate, skipping any at_exit blocks.
30
31
  exit!(0)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spork
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.6
4
+ version: 0.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Harper
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-02 00:00:00 -07:00
12
+ date: 2010-03-03 00:00:00 -07:00
13
13
  default_executable: spork
14
14
  dependencies: []
15
15