spork 0.7.6 → 0.7.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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 {
|
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 "
|
34
|
+
Then the output should contain "second first"
|
34
35
|
Then the output should not contain "prefork at_exit called"
|
data/lib/spork.rb
CHANGED
@@ -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
|
-
|
81
|
-
after_each_run_procs.
|
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!
|
data/lib/spork/forker.rb
CHANGED
@@ -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
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
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.
|
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-
|
12
|
+
date: 2010-03-03 00:00:00 -07:00
|
13
13
|
default_executable: spork
|
14
14
|
dependencies: []
|
15
15
|
|