wakiki-spork 0.8.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +6 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +127 -0
- data/assets/bootstrap.rb +29 -0
- data/bin/spork +20 -0
- data/ext/mkrf_conf.rb +26 -0
- data/features/at_exit_during_each_run.feature +35 -0
- data/features/cucumber_rails_integration.feature +111 -0
- data/features/diagnostic_mode.feature +41 -0
- data/features/gemfiles/rails3.0/Gemfile +10 -0
- data/features/gemfiles/rails3.0/Gemfile.lock +135 -0
- data/features/rails_delayed_loading_workarounds.feature +115 -0
- data/features/rspec_rails_integration.feature +92 -0
- data/features/spork_debugger.feature +108 -0
- data/features/steps/general_steps.rb +3 -0
- data/features/steps/rails_steps.rb +63 -0
- data/features/steps/sandbox_steps.rb +115 -0
- data/features/support/background_job.rb +63 -0
- data/features/support/bundler_helpers.rb +42 -0
- data/features/support/env.rb +117 -0
- data/features/unknown_app_framework.feature +42 -0
- data/lib/spork.rb +156 -0
- data/lib/spork/app_framework.rb +80 -0
- data/lib/spork/app_framework/padrino.rb +22 -0
- data/lib/spork/app_framework/rails.rb +167 -0
- data/lib/spork/app_framework/rails_stub_files/application.rb +1 -0
- data/lib/spork/app_framework/rails_stub_files/application_controller.rb +22 -0
- data/lib/spork/app_framework/rails_stub_files/application_helper.rb +3 -0
- data/lib/spork/app_framework/unknown.rb +6 -0
- data/lib/spork/custom_io_streams.rb +25 -0
- data/lib/spork/diagnoser.rb +105 -0
- data/lib/spork/ext/rails-reloader.rb +14 -0
- data/lib/spork/ext/ruby-debug.rb +150 -0
- data/lib/spork/forker.rb +71 -0
- data/lib/spork/run_strategy.rb +44 -0
- data/lib/spork/run_strategy/forking.rb +32 -0
- data/lib/spork/run_strategy/magazine.rb +121 -0
- data/lib/spork/run_strategy/magazine/magazine_slave.rb +30 -0
- data/lib/spork/run_strategy/magazine/magazine_slave_provider.rb +27 -0
- data/lib/spork/run_strategy/magazine/ring_server.rb +10 -0
- data/lib/spork/runner.rb +91 -0
- data/lib/spork/server.rb +74 -0
- data/lib/spork/test_framework.rb +167 -0
- data/lib/spork/test_framework/cucumber.rb +24 -0
- data/lib/spork/test_framework/rspec.rb +14 -0
- data/spec/spec_helper.rb +108 -0
- data/spec/spork/app_framework/rails_spec.rb +22 -0
- data/spec/spork/app_framework/unknown_spec.rb +12 -0
- data/spec/spork/app_framework_spec.rb +16 -0
- data/spec/spork/diagnoser_spec.rb +105 -0
- data/spec/spork/forker_spec.rb +44 -0
- data/spec/spork/run_strategy/forking_spec.rb +38 -0
- data/spec/spork/runner_spec.rb +50 -0
- data/spec/spork/server_spec.rb +15 -0
- data/spec/spork/test_framework/cucumber_spec.rb +11 -0
- data/spec/spork/test_framework/rspec_spec.rb +10 -0
- data/spec/spork/test_framework_spec.rb +114 -0
- data/spec/spork_spec.rb +151 -0
- data/spec/support/fake_framework.rb +15 -0
- data/spec/support/fake_run_strategy.rb +21 -0
- metadata +159 -0
data/lib/spork/forker.rb
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
# A helper class that allows you to run a block inside of a fork, and then get the result from that block.
|
2
|
+
#
|
3
|
+
# == Example:
|
4
|
+
#
|
5
|
+
# forker = Spork::Forker.new do
|
6
|
+
# sleep 3
|
7
|
+
# "success"
|
8
|
+
# end
|
9
|
+
#
|
10
|
+
# forker.result # => "success"
|
11
|
+
class Spork::Forker
|
12
|
+
|
13
|
+
# Raised if the fork died (was killed) before it sent it's response back.
|
14
|
+
class ForkDiedException < Exception; end
|
15
|
+
def initialize(&block)
|
16
|
+
return unless block_given?
|
17
|
+
@child_io, @server_io = UNIXSocket.socketpair
|
18
|
+
@child_pid = Kernel.fork do
|
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
|
29
|
+
|
30
|
+
# terminate, skipping any at_exit blocks.
|
31
|
+
exit!(0)
|
32
|
+
end
|
33
|
+
@child_io.close
|
34
|
+
end
|
35
|
+
|
36
|
+
# Wait for the fork to finish running, and then return its return value.
|
37
|
+
#
|
38
|
+
# If the fork was aborted, then result returns nil.
|
39
|
+
def result
|
40
|
+
return unless running?
|
41
|
+
result_thread = Thread.new do
|
42
|
+
begin
|
43
|
+
@result = Marshal.load(@server_io)
|
44
|
+
Marshal.dump('ACK', @server_io)
|
45
|
+
rescue ForkDiedException, EOFError
|
46
|
+
@result = nil
|
47
|
+
end
|
48
|
+
end
|
49
|
+
Process.wait(@child_pid)
|
50
|
+
result_thread.raise(ForkDiedException) if @result.nil?
|
51
|
+
@child_pid = nil
|
52
|
+
@result
|
53
|
+
end
|
54
|
+
|
55
|
+
# abort the current running fork
|
56
|
+
def abort
|
57
|
+
if running?
|
58
|
+
Process.kill(Signal.list['TERM'], @child_pid)
|
59
|
+
@child_pid = nil
|
60
|
+
true
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def running?
|
65
|
+
return false unless @child_pid
|
66
|
+
Process.getpgid(@child_pid)
|
67
|
+
true
|
68
|
+
rescue Errno::ESRCH
|
69
|
+
false
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
class Spork::RunStrategy
|
2
|
+
attr_reader :test_framework
|
3
|
+
@@run_strategies = []
|
4
|
+
|
5
|
+
def initialize(test_framework)
|
6
|
+
@test_framework = test_framework
|
7
|
+
end
|
8
|
+
|
9
|
+
def preload
|
10
|
+
raise NotImplementedError
|
11
|
+
end
|
12
|
+
|
13
|
+
def run(argv, input, output)
|
14
|
+
raise NotImplementedError
|
15
|
+
end
|
16
|
+
|
17
|
+
def cleanup
|
18
|
+
raise NotImplementedError
|
19
|
+
end
|
20
|
+
|
21
|
+
def running?
|
22
|
+
raise NotImplementedError
|
23
|
+
end
|
24
|
+
|
25
|
+
def abort
|
26
|
+
raise NotImplementedError
|
27
|
+
end
|
28
|
+
|
29
|
+
protected
|
30
|
+
def self.factory(test_framework)
|
31
|
+
if RUBY_PLATFORM =~ /mswin|mingw/
|
32
|
+
Spork::RunStrategy::Magazine.new(test_framework)
|
33
|
+
else
|
34
|
+
Spork::RunStrategy::Forking.new(test_framework)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.inherited(subclass)
|
39
|
+
@@run_strategies << subclass
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
Dir[File.dirname(__FILE__) + "/run_strategy/*.rb"].each { |file| require file }
|
@@ -0,0 +1,32 @@
|
|
1
|
+
class Spork::RunStrategy::Forking < Spork::RunStrategy
|
2
|
+
def self.available?
|
3
|
+
Kernel.respond_to?(:fork)
|
4
|
+
end
|
5
|
+
|
6
|
+
def run(argv, stderr, stdout)
|
7
|
+
abort if running?
|
8
|
+
|
9
|
+
@child = ::Spork::Forker.new do
|
10
|
+
$stdout, $stderr = stdout, stderr
|
11
|
+
load test_framework.helper_file
|
12
|
+
Spork.exec_each_run
|
13
|
+
result = test_framework.run_tests(argv, stderr, stdout)
|
14
|
+
Spork.exec_after_each_run
|
15
|
+
result
|
16
|
+
end
|
17
|
+
@child.result
|
18
|
+
end
|
19
|
+
|
20
|
+
def abort
|
21
|
+
@child && @child.abort
|
22
|
+
end
|
23
|
+
|
24
|
+
def preload
|
25
|
+
test_framework.preload
|
26
|
+
end
|
27
|
+
|
28
|
+
def running?
|
29
|
+
@child && @child.running?
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# this class' goal:
|
2
|
+
# to boldly just run test after test
|
3
|
+
# as they come in
|
4
|
+
require 'drb'
|
5
|
+
require 'rinda/ring'
|
6
|
+
require 'win32/process' if RUBY_PLATFORM =~ /mswin|mingw/ and RUBY_VERSION < '1.9.1'
|
7
|
+
|
8
|
+
$:.unshift(File.dirname(__FILE__))
|
9
|
+
require 'magazine/magazine_slave'
|
10
|
+
|
11
|
+
|
12
|
+
class Spork::RunStrategy::Magazine < Spork::RunStrategy
|
13
|
+
|
14
|
+
Slave_Id_Range = 1..2 # Ringserver uses id: 0. Slave use: 1..MAX_SLAVES
|
15
|
+
|
16
|
+
def slave_max
|
17
|
+
Slave_Id_Range.to_a.size
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(test_framework)
|
21
|
+
@test_framework = test_framework
|
22
|
+
this_path = File.expand_path(File.dirname(__FILE__))
|
23
|
+
@path = File.join(this_path, 'magazine')
|
24
|
+
@pids = []
|
25
|
+
|
26
|
+
@pids << start_Rinda_ringserver
|
27
|
+
sleep 1
|
28
|
+
|
29
|
+
fill_slave_pool
|
30
|
+
rescue RuntimeError => e
|
31
|
+
kill_all_processes
|
32
|
+
raise e
|
33
|
+
end
|
34
|
+
|
35
|
+
def start_Rinda_ringserver
|
36
|
+
app_name = 'ruby ring_server.rb'
|
37
|
+
spawn_process(app_name)
|
38
|
+
end
|
39
|
+
|
40
|
+
def fill_slave_pool
|
41
|
+
Slave_Id_Range.each do |id|
|
42
|
+
start_slave(id)
|
43
|
+
end
|
44
|
+
puts " -- Starting to fill pool..."
|
45
|
+
puts " Wait until at least one slave is provided before running tests..."
|
46
|
+
puts " ** CTRL+BREAK to stop Spork and kill all ruby slave processes **"
|
47
|
+
$stdout.flush
|
48
|
+
end
|
49
|
+
|
50
|
+
def start_slave(id)
|
51
|
+
app_pwd = Dir.pwd # path running app in
|
52
|
+
app = "ruby magazine_slave_provider.rb #{id} '#{app_pwd}' #{@test_framework.short_name}"
|
53
|
+
@pids[id] = spawn_process(app)
|
54
|
+
end
|
55
|
+
|
56
|
+
def spawn_process(app)
|
57
|
+
if RUBY_VERSION < '1.9.1'
|
58
|
+
Process.create( :app_name => app, :cwd => @path ).process_id
|
59
|
+
else
|
60
|
+
Process.spawn( app, :chdir => @path )
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.available?
|
65
|
+
true
|
66
|
+
end
|
67
|
+
|
68
|
+
def run(argv, stderr, stdout)
|
69
|
+
DRb.start_service
|
70
|
+
ts = Rinda::RingFinger.primary
|
71
|
+
if ts.read_all([:name, :MagazineSlave, nil, nil]).size > 0
|
72
|
+
print ' <-- take tuple'; stdout.flush
|
73
|
+
tuple = ts.take([:name, :MagazineSlave, nil, nil])
|
74
|
+
slave = tuple[2]
|
75
|
+
id = tuple[3]
|
76
|
+
|
77
|
+
puts "(#{slave.id_num}); slave.run..."; $stdout.flush
|
78
|
+
begin
|
79
|
+
slave.run(argv,stderr,stdout)
|
80
|
+
puts " -- (#{slave.id_num});run done"; $stdout.flush
|
81
|
+
ensure
|
82
|
+
restart_slave(id)
|
83
|
+
end
|
84
|
+
else
|
85
|
+
puts '- NO tuple'; $stdout.flush
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def restart_slave(id)
|
90
|
+
pid = @pids[id]
|
91
|
+
Process.kill(9, pid)
|
92
|
+
start_slave(id)
|
93
|
+
end
|
94
|
+
|
95
|
+
def kill_all_processes
|
96
|
+
|
97
|
+
@pids.each {|pid| Process.kill(9, pid)}
|
98
|
+
puts "\nKilling processes."; $stdout.flush
|
99
|
+
end
|
100
|
+
|
101
|
+
def slave_count
|
102
|
+
DRb.start_service
|
103
|
+
ts = Rinda::RingFinger.primary
|
104
|
+
ts.read_all([:name, :MagazineSlave, nil, nil]).size
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
def abort
|
109
|
+
kill_all_processes
|
110
|
+
end
|
111
|
+
|
112
|
+
def preload
|
113
|
+
true
|
114
|
+
# @test_framework.preload
|
115
|
+
end
|
116
|
+
|
117
|
+
def running?
|
118
|
+
@running
|
119
|
+
end
|
120
|
+
|
121
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'drb'
|
3
|
+
$:.unshift(File.dirname(__FILE__) + "/../../..") # directory of spork.rb
|
4
|
+
require 'spork'
|
5
|
+
|
6
|
+
class MagazineSlave
|
7
|
+
include DRb::DRbUndumped
|
8
|
+
attr_reader :id_num
|
9
|
+
def initialize(id_num, test_framework_short_name)
|
10
|
+
@id_num = id_num
|
11
|
+
@test_framework = Spork::TestFramework.factory(STDOUT, STDERR,
|
12
|
+
test_framework_short_name)
|
13
|
+
# ENV["DRB"] = 'true'
|
14
|
+
# Spork.using_spork!
|
15
|
+
return(nil) unless preload
|
16
|
+
end
|
17
|
+
|
18
|
+
def run(argv, stderr, stdout)
|
19
|
+
$stdout, $stderr = stdout, stderr
|
20
|
+
Spork.exec_each_run
|
21
|
+
load @test_framework.helper_file
|
22
|
+
@test_framework.run_tests(argv, stderr, stdout)
|
23
|
+
puts " <-- Slave(#{@id_num}) run done!"; stdout.flush
|
24
|
+
end
|
25
|
+
|
26
|
+
def preload
|
27
|
+
@test_framework.preload
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# magazine_slave_provider.rb
|
2
|
+
require 'drb'
|
3
|
+
require 'rinda/ring'
|
4
|
+
require 'rinda/tuplespace'
|
5
|
+
require 'magazine_slave'
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
# pass on
|
10
|
+
|
11
|
+
id = ARGV[0].to_i || "?"
|
12
|
+
app_pwd = ARGV[1]
|
13
|
+
test_framework_short_name = ARGV[2]
|
14
|
+
|
15
|
+
# start up the Rinda service
|
16
|
+
|
17
|
+
DRb.start_service
|
18
|
+
|
19
|
+
Dir.chdir app_pwd
|
20
|
+
puts " -- build slave #{id}..."; $stdout.flush
|
21
|
+
magazine_slave = MagazineSlave.new(id, test_framework_short_name )
|
22
|
+
Rinda::RingProvider.new(:MagazineSlave, magazine_slave, id).provide
|
23
|
+
|
24
|
+
puts " --> DRb magazine_slave_service: #{id} provided..."; $stdout.flush
|
25
|
+
|
26
|
+
# wait for the DRb service to finish before exiting
|
27
|
+
DRb.thread.join
|
data/lib/spork/runner.rb
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'stringio'
|
3
|
+
|
4
|
+
module Spork
|
5
|
+
# This is used by bin/spork. It's wrapped in a class because it's easier to test that way.
|
6
|
+
class Runner
|
7
|
+
attr_reader :test_framework
|
8
|
+
|
9
|
+
def self.run(args, output, error)
|
10
|
+
self.new(args, output, error).run
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(args, output, error)
|
14
|
+
raise ArgumentError, "expected array of args" unless args.is_a?(Array)
|
15
|
+
@output = output
|
16
|
+
@error = error
|
17
|
+
@options = {}
|
18
|
+
opt = OptionParser.new
|
19
|
+
opt.banner = "Usage: spork [test framework name] [options]\n\n"
|
20
|
+
|
21
|
+
opt.separator "Options:"
|
22
|
+
opt.on("-b", "--bootstrap") {|ignore| @options[:bootstrap] = true }
|
23
|
+
opt.on("-d", "--diagnose") {|ignore| @options[:diagnose] = true }
|
24
|
+
opt.on("-h", "--help") {|ignore| @options[:help] = true }
|
25
|
+
opt.on("-p", "--port [PORT]") {|port| @options[:port] = port }
|
26
|
+
non_option_args = args.select { |arg| ! args[0].match(/^-/) }
|
27
|
+
@options[:server_matcher] = non_option_args[0]
|
28
|
+
opt.parse!(args)
|
29
|
+
|
30
|
+
if @options[:help]
|
31
|
+
@output.puts opt
|
32
|
+
@output.puts
|
33
|
+
@output.puts supported_test_frameworks_text
|
34
|
+
exit(0)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def supported_test_frameworks_text
|
39
|
+
text = StringIO.new
|
40
|
+
|
41
|
+
text.puts "Supported test frameworks:"
|
42
|
+
text.puts Spork::TestFramework.supported_test_frameworks.sort { |a,b| a.short_name <=> b.short_name }.map { |s| (s.available? ? '(*) ' : '( ) ') + s.short_name }
|
43
|
+
text.puts "\nLegend: ( ) - not detected in project (*) - detected\n"
|
44
|
+
text.string
|
45
|
+
end
|
46
|
+
|
47
|
+
# Returns a server for the specified (or the detected default) testing framework. Returns nil if none detected, or if the specified is not supported or available.
|
48
|
+
def find_test_framework
|
49
|
+
Spork::TestFramework.factory(@output, @error, options[:server_matcher])
|
50
|
+
rescue Spork::TestFramework::NoFrameworksAvailable => e
|
51
|
+
@error.puts e.message
|
52
|
+
rescue Spork::TestFramework::FactoryException => e
|
53
|
+
@error.puts "#{e.message}\n\n#{supported_test_frameworks_text}"
|
54
|
+
end
|
55
|
+
|
56
|
+
def run
|
57
|
+
return false unless test_framework = find_test_framework
|
58
|
+
ENV["DRB"] = 'true'
|
59
|
+
@error.puts "Using #{test_framework.short_name}"
|
60
|
+
@error.flush
|
61
|
+
|
62
|
+
case
|
63
|
+
when options[:bootstrap]
|
64
|
+
test_framework.bootstrap
|
65
|
+
when options[:diagnose]
|
66
|
+
require 'spork/diagnoser'
|
67
|
+
|
68
|
+
Spork::Diagnoser.install_hook!(test_framework.entry_point)
|
69
|
+
test_framework.preload
|
70
|
+
Spork::Diagnoser.output_results(@output)
|
71
|
+
return true
|
72
|
+
else
|
73
|
+
Spork.using_spork!
|
74
|
+
run_strategy = Spork::RunStrategy.factory(test_framework)
|
75
|
+
return(false) unless run_strategy.preload
|
76
|
+
Spork::Server.run(:port => @options[:port] || test_framework.default_port, :run_strategy => run_strategy)
|
77
|
+
return true
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
private
|
82
|
+
attr_reader :options
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
data/lib/spork/server.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'drb/drb'
|
2
|
+
require 'rbconfig'
|
3
|
+
require 'spork/forker.rb'
|
4
|
+
require 'spork/custom_io_streams.rb'
|
5
|
+
require 'spork/app_framework.rb'
|
6
|
+
|
7
|
+
# An abstract class that is implemented to create a server
|
8
|
+
#
|
9
|
+
# (This was originally based off of spec_server.rb from rspec-rails (David Chelimsky), which was based on Florian Weber's TDDMate)
|
10
|
+
class Spork::Server
|
11
|
+
attr_reader :run_strategy
|
12
|
+
include Spork::CustomIOStreams
|
13
|
+
|
14
|
+
def initialize(options = {})
|
15
|
+
@run_strategy = options[:run_strategy]
|
16
|
+
@port = options[:port]
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.run(options = {})
|
20
|
+
new(options).listen
|
21
|
+
end
|
22
|
+
|
23
|
+
# Sets up signals and starts the DRb service. If it's successful, it doesn't return. Not ever. You don't need to override this.
|
24
|
+
def listen
|
25
|
+
raise RuntimeError, "you must call Spork.using_spork! before starting the server" unless Spork.using_spork?
|
26
|
+
trap("SIGINT") { sig_int_received }
|
27
|
+
trap("SIGTERM") { abort; exit!(0) }
|
28
|
+
trap("USR2") { abort; restart } if Signal.list.has_key?("USR2")
|
29
|
+
@drb_service = DRb.start_service("druby://127.0.0.1:#{port}", self)
|
30
|
+
Spork.each_run { @drb_service.stop_service } if @run_strategy.class == Spork::RunStrategy::Forking
|
31
|
+
stderr.puts "Spork is ready and listening on #{port}!"
|
32
|
+
stderr.flush
|
33
|
+
DRb.thread.join
|
34
|
+
end
|
35
|
+
|
36
|
+
attr_accessor :port
|
37
|
+
|
38
|
+
# This is the public facing method that is served up by DRb. To use it from the client side (in a testing framework):
|
39
|
+
#
|
40
|
+
# DRb.start_service("druby://localhost:0") # this allows Ruby to do some magical stuff so you can pass an output stream over DRb.
|
41
|
+
# # see http://redmine.ruby-lang.org/issues/show/496 to see why localhost:0 is used.
|
42
|
+
# spec_server = DRbObject.new_with_uri("druby://127.0.0.1:8989")
|
43
|
+
# spec_server.run(options.argv, $stderr, $stdout)
|
44
|
+
#
|
45
|
+
# When implementing a test server, don't override this method: override run_tests instead.
|
46
|
+
def run(argv, stderr, stdout)
|
47
|
+
run_strategy.run(argv, stderr, stdout)
|
48
|
+
end
|
49
|
+
|
50
|
+
def abort
|
51
|
+
run_strategy.abort
|
52
|
+
end
|
53
|
+
|
54
|
+
private
|
55
|
+
def restart
|
56
|
+
stderr.puts "restarting"
|
57
|
+
stderr.flush
|
58
|
+
config = ::Config::CONFIG
|
59
|
+
ruby = File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT']
|
60
|
+
command_line = [ruby, $0, ARGV].flatten.join(' ')
|
61
|
+
exec(command_line)
|
62
|
+
end
|
63
|
+
|
64
|
+
def sig_int_received
|
65
|
+
stdout.puts "\n"
|
66
|
+
if run_strategy.running?
|
67
|
+
abort
|
68
|
+
stderr.puts "Running tests stopped. Press CTRL-C again to stop the server."
|
69
|
+
stderr.flush
|
70
|
+
else
|
71
|
+
exit!(0)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|