spork 1.0.0rc2-x86-mingw32 → 1.0.0rc4-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +5 -5
- data/README.rdoc +1 -1
- data/features/support/bundler_helpers.rb +4 -2
- data/features/support/spork_world.rb +14 -2
- data/lib/spork/diagnoser.rb +1 -1
- data/lib/spork/forker.rb +12 -9
- data/lib/spork/run_strategy/magazine.rb +17 -18
- data/lib/spork/run_strategy/magazine/magazine_slave.rb +0 -0
- data/lib/spork/run_strategy/magazine/magazine_slave_provider.rb +1 -0
- data/lib/spork/run_strategy/magazine/rinda_ring_finger_patch.rb +26 -0
- data/lib/spork/run_strategy/magazine/ring_server.rb +1 -0
- data/lib/spork/runner.rb +2 -1
- data/lib/spork/server.rb +3 -2
- data/spec/spork/forker_spec.rb +6 -1
- metadata +14 -13
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8d9d9fee10c8579a916a1a9ea40f6f819d288324
|
4
|
+
data.tar.gz: dc63d581fde6cb9b5e88b252edfbe5351063a8ac
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7f7bba2f1d0adb05376fb69abf4a4b1ae84b1300824550be0822cf7eeef9e91f8338d009bf70872c6e93f8d6553033c7097769bb5ed9e9630a0b5ed03b5275f1
|
7
|
+
data.tar.gz: e9f8559eb56aed5a5f2a750651cb025d59629660f440942aa20ed49dc7ce8064c44372db536d0b975ab87bc76b72f09b3e5ab66846dd3f78aefc4e9dfa2efdfa
|
data/Gemfile
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
gemspec
|
3
|
-
gem 'cucumber', '~>
|
4
|
-
gem 'rspec', '~>
|
3
|
+
gem 'cucumber', '~>1.3.2'
|
4
|
+
gem 'rspec', '~>2.13.0'
|
5
5
|
gem 'rake'
|
6
6
|
gem "spork", :path => File.expand_path("../", __FILE__)
|
7
7
|
|
8
|
-
if RUBY_VERSION =~ /^1\.9/
|
9
|
-
gem '
|
8
|
+
if RUBY_VERSION =~ /^2\.0|^1\.9/
|
9
|
+
gem 'debugger'
|
10
10
|
else
|
11
11
|
gem 'ruby-debug'
|
12
12
|
end
|
data/README.rdoc
CHANGED
@@ -2,8 +2,10 @@ module BundlerHelpers
|
|
2
2
|
extend self
|
3
3
|
def install_bundle(dir)
|
4
4
|
Dir.chdir(dir) do
|
5
|
-
command = "
|
6
|
-
|
5
|
+
command = "bundle install --gemfile=#{Dir.pwd}/Gemfile --path=#{Dir.pwd}/.bundle"
|
6
|
+
Bundler.with_clean_env do
|
7
|
+
system(command)
|
8
|
+
end
|
7
9
|
$?.exitstatus
|
8
10
|
end
|
9
11
|
end
|
@@ -53,7 +53,15 @@ class SporkWorld
|
|
53
53
|
stderr_file = Tempfile.new('spork')
|
54
54
|
stderr_file.close
|
55
55
|
in_current_dir do
|
56
|
-
|
56
|
+
if command.start_with?("rails new")
|
57
|
+
@last_stdout = `bundle exec #{command} 2> #{stderr_file.path}`
|
58
|
+
else
|
59
|
+
gemfile = ENV['BUNDLE_GEMFILE']
|
60
|
+
Bundler.with_clean_env do
|
61
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
62
|
+
@last_stdout = `bundle exec #{command} 2> #{stderr_file.path}`
|
63
|
+
end
|
64
|
+
end
|
57
65
|
@last_exit_status = $?.exitstatus
|
58
66
|
end
|
59
67
|
@last_stderr = IO.read(stderr_file.path)
|
@@ -61,7 +69,11 @@ class SporkWorld
|
|
61
69
|
|
62
70
|
def run_in_background(command)
|
63
71
|
in_current_dir do
|
64
|
-
|
72
|
+
gemfile = ENV['BUNDLE_GEMFILE']
|
73
|
+
Bundler.with_clean_env do
|
74
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
75
|
+
@background_job = BackgroundJob.run("bundle exec " + command)
|
76
|
+
end
|
65
77
|
end
|
66
78
|
@background_jobs << @background_job
|
67
79
|
@background_job
|
data/lib/spork/diagnoser.rb
CHANGED
data/lib/spork/forker.rb
CHANGED
@@ -6,10 +6,10 @@
|
|
6
6
|
# sleep 3
|
7
7
|
# "success"
|
8
8
|
# end
|
9
|
-
#
|
9
|
+
#
|
10
10
|
# forker.result # => "success"
|
11
11
|
class Spork::Forker
|
12
|
-
|
12
|
+
|
13
13
|
# Raised if the fork died (was killed) before it sent it's response back.
|
14
14
|
class ForkDiedException < Exception; end
|
15
15
|
def initialize(&block)
|
@@ -23,35 +23,38 @@ class Spork::Forker
|
|
23
23
|
master_response = Marshal.load(@child_io)
|
24
24
|
rescue EOFError
|
25
25
|
nil
|
26
|
+
rescue SystemExit => e
|
27
|
+
puts "Error: exit code #{e.status}" unless e.status == 0
|
26
28
|
rescue Exception => e
|
27
29
|
puts "Exception encountered: #{e.inspect}\nbacktrace:\n#{e.backtrace * %(\n)}"
|
28
30
|
end
|
29
|
-
|
31
|
+
|
30
32
|
# terminate, skipping any at_exit blocks.
|
31
33
|
exit!(0)
|
32
34
|
end
|
33
35
|
@child_io.close
|
34
36
|
end
|
35
|
-
|
37
|
+
|
36
38
|
# Wait for the fork to finish running, and then return its return value.
|
37
39
|
#
|
38
40
|
# If the fork was aborted, then result returns nil.
|
39
41
|
def result
|
40
|
-
return
|
42
|
+
return @result if defined?(@result) || ! running?
|
41
43
|
result_thread = Thread.new do
|
42
44
|
begin
|
43
45
|
@result = Marshal.load(@server_io)
|
44
46
|
Marshal.dump('ACK', @server_io)
|
45
|
-
rescue
|
47
|
+
rescue EOFError
|
46
48
|
@result = nil
|
49
|
+
rescue ForkDiedException
|
47
50
|
end
|
48
51
|
end
|
49
52
|
Process.wait(@child_pid)
|
50
|
-
result_thread.raise(ForkDiedException) if
|
53
|
+
result_thread.raise(ForkDiedException) if result_thread.status == "sleep"
|
51
54
|
@child_pid = nil
|
52
55
|
@result
|
53
56
|
end
|
54
|
-
|
57
|
+
|
55
58
|
# abort the current running fork
|
56
59
|
def abort
|
57
60
|
if running?
|
@@ -60,7 +63,7 @@ class Spork::Forker
|
|
60
63
|
true
|
61
64
|
end
|
62
65
|
end
|
63
|
-
|
66
|
+
|
64
67
|
def running?
|
65
68
|
return false unless @child_pid
|
66
69
|
Process.getpgid(@child_pid)
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# to boldly just run test after test
|
3
3
|
# as they come in
|
4
4
|
require 'drb'
|
5
|
+
require 'timeout'
|
5
6
|
require 'rinda/ring'
|
6
7
|
if RUBY_PLATFORM =~ /mswin|mingw/ and RUBY_VERSION < '1.9.1'
|
7
8
|
begin
|
@@ -16,6 +17,7 @@ require 'rubygems' # used for Gem.ruby
|
|
16
17
|
|
17
18
|
$:.unshift(File.dirname(__FILE__))
|
18
19
|
require 'magazine/magazine_slave'
|
20
|
+
require 'magazine/rinda_ring_finger_patch' if RUBY_VERSION > '1.9.1'
|
19
21
|
|
20
22
|
class Spork::RunStrategy::Magazine < Spork::RunStrategy
|
21
23
|
|
@@ -84,24 +86,21 @@ class Spork::RunStrategy::Magazine < Spork::RunStrategy
|
|
84
86
|
end
|
85
87
|
|
86
88
|
def run(argv, stderr, stdout)
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
else
|
103
|
-
puts '- NO tuple'; $stdout.flush
|
104
|
-
end
|
89
|
+
DRb.start_service
|
90
|
+
ts = Rinda::RingFinger.primary
|
91
|
+
Timeout.timeout(60) {sleep 0.1 until ts.read_all([:name, :MagazineSlave, nil, nil]).size > 0}
|
92
|
+
print ' <-- take tuple'; stdout.flush
|
93
|
+
tuple = ts.take([:name, :MagazineSlave, nil, nil])
|
94
|
+
slave = tuple[2]
|
95
|
+
id = tuple[3]
|
96
|
+
|
97
|
+
puts "(#{slave.id_num}); slave.run..."; $stdout.flush
|
98
|
+
begin
|
99
|
+
slave.run(argv,stderr,stdout)
|
100
|
+
puts " -- (#{slave.id_num});run done"; $stdout.flush
|
101
|
+
ensure
|
102
|
+
restart_slave(id)
|
103
|
+
end
|
105
104
|
end
|
106
105
|
|
107
106
|
def restart_slave(id)
|
File without changes
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Patch for Rinda::RingFinger.primary hanging forever on Ruby 1.9.2 & 1.9.3
|
2
|
+
# from http://www.ruby-forum.com/topic/4229908
|
3
|
+
require 'rinda/ring'
|
4
|
+
|
5
|
+
module Rinda
|
6
|
+
class RingFinger
|
7
|
+
def lookup_ring_any(timeout=5)
|
8
|
+
queue = Queue.new
|
9
|
+
|
10
|
+
Thread.new do
|
11
|
+
self.lookup_ring(timeout) do |ts|
|
12
|
+
queue.push(ts)
|
13
|
+
end
|
14
|
+
queue.push(nil)
|
15
|
+
end
|
16
|
+
|
17
|
+
@primary = queue.pop
|
18
|
+
raise('RingNotFound') if @primary.nil?
|
19
|
+
while it = queue.pop
|
20
|
+
@rings.push(it)
|
21
|
+
end
|
22
|
+
|
23
|
+
@primary
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/spork/runner.rb
CHANGED
@@ -22,6 +22,7 @@ module Spork
|
|
22
22
|
opt.on("-b", "--bootstrap") {|ignore| @options[:bootstrap] = true }
|
23
23
|
opt.on("-d", "--diagnose") {|ignore| @options[:diagnose] = true }
|
24
24
|
opt.on("-h", "--help") {|ignore| @options[:help] = true }
|
25
|
+
opt.on("-q", "--quiet") {|ignore| @options[:quiet] = true }
|
25
26
|
opt.on("-p", "--port [PORT]") {|port| @options[:port] = port }
|
26
27
|
non_option_args = args.select { |arg| ! args[0].match(/^-/) }
|
27
28
|
@options[:server_matcher] = non_option_args[0]
|
@@ -72,7 +73,7 @@ module Spork
|
|
72
73
|
else
|
73
74
|
run_strategy = Spork::RunStrategy.factory(test_framework)
|
74
75
|
return(false) unless run_strategy.preload
|
75
|
-
Spork::Server.run(:port => @options[:port] || test_framework.default_port, :run_strategy => run_strategy)
|
76
|
+
Spork::Server.run(:port => @options[:port] || test_framework.default_port, :run_strategy => run_strategy, :quiet => @options[:quiet])
|
76
77
|
return true
|
77
78
|
end
|
78
79
|
end
|
data/lib/spork/server.rb
CHANGED
@@ -14,6 +14,7 @@ class Spork::Server
|
|
14
14
|
def initialize(options = {})
|
15
15
|
@run_strategy = options[:run_strategy]
|
16
16
|
@port = options[:port]
|
17
|
+
@quiet = options[:quiet]
|
17
18
|
end
|
18
19
|
|
19
20
|
def self.run(options = {})
|
@@ -44,9 +45,9 @@ class Spork::Server
|
|
44
45
|
#
|
45
46
|
# When implementing a test server, don't override this method: override run_tests instead.
|
46
47
|
def run(argv, stderr, stdout)
|
47
|
-
puts "Running tests with args #{argv.inspect}..."
|
48
|
+
puts "Running tests with args #{argv.inspect}..." unless @quiet
|
48
49
|
result = run_strategy.run(argv, stderr, stdout)
|
49
|
-
puts "Done.\n\n"
|
50
|
+
puts "Done.\n\n" unless @quiet
|
50
51
|
result
|
51
52
|
end
|
52
53
|
|
data/spec/spork/forker_spec.rb
CHANGED
@@ -29,7 +29,12 @@ describe Spork::Forker do
|
|
29
29
|
it "aborts a fork and returns nil for the result" do
|
30
30
|
started_at = Time.now
|
31
31
|
ended_at = nil
|
32
|
-
forker = Spork::Forker.new
|
32
|
+
forker = Spork::Forker.new do
|
33
|
+
begin
|
34
|
+
sleep 5
|
35
|
+
rescue SignalException
|
36
|
+
end
|
37
|
+
end
|
33
38
|
Thread.new do
|
34
39
|
forker.result.should == nil
|
35
40
|
ended_at = Time.now
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spork
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease: 5
|
4
|
+
version: 1.0.0rc4
|
6
5
|
platform: x86-mingw32
|
7
6
|
authors:
|
8
7
|
- Tim Harper
|
@@ -10,19 +9,22 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date:
|
12
|
+
date: 2013-09-14 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: win32-process
|
17
|
-
requirement:
|
18
|
-
none: false
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - '>='
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: '0'
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
|
-
version_requirements:
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
26
28
|
description: A forking Drb spec server
|
27
29
|
email:
|
28
30
|
- timcharper+spork@gmail.com
|
@@ -46,6 +48,7 @@ files:
|
|
46
48
|
- lib/spork/run_strategy/forking.rb
|
47
49
|
- lib/spork/run_strategy/magazine/magazine_slave.rb
|
48
50
|
- lib/spork/run_strategy/magazine/magazine_slave_provider.rb
|
51
|
+
- lib/spork/run_strategy/magazine/rinda_ring_finger_patch.rb
|
49
52
|
- lib/spork/run_strategy/magazine/ring_server.rb
|
50
53
|
- lib/spork/run_strategy/magazine.rb
|
51
54
|
- lib/spork/run_strategy.rb
|
@@ -89,6 +92,7 @@ files:
|
|
89
92
|
- bin/spork
|
90
93
|
homepage: http://github.com/sporkrb/spork
|
91
94
|
licenses: []
|
95
|
+
metadata: {}
|
92
96
|
post_install_message:
|
93
97
|
rdoc_options:
|
94
98
|
- --main
|
@@ -96,20 +100,18 @@ rdoc_options:
|
|
96
100
|
require_paths:
|
97
101
|
- lib
|
98
102
|
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
103
|
requirements:
|
101
|
-
- -
|
104
|
+
- - '>='
|
102
105
|
- !ruby/object:Gem::Version
|
103
106
|
version: '0'
|
104
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
108
|
requirements:
|
107
|
-
- -
|
109
|
+
- - '>='
|
108
110
|
- !ruby/object:Gem::Version
|
109
111
|
version: '0'
|
110
112
|
requirements: []
|
111
113
|
rubyforge_project:
|
112
|
-
rubygems_version: 1.
|
114
|
+
rubygems_version: 2.1.3
|
113
115
|
signing_key:
|
114
116
|
specification_version: 3
|
115
117
|
summary: spork
|
@@ -142,4 +144,3 @@ test_files:
|
|
142
144
|
- spec/support/should_include_a_string_like.rb
|
143
145
|
- spec/support/test_io_streams.rb
|
144
146
|
- spec/support/tmp_project_helpers.rb
|
145
|
-
has_rdoc:
|