# File lib/spork/run_strategy/magazine.rb, line 64
64: def self.available?
65: true
66: end
# File lib/spork/run_strategy/magazine.rb, line 20
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
# File lib/spork/run_strategy/magazine.rb, line 108
108: def abort
109: kill_all_processes
110: end
# File lib/spork/run_strategy/magazine.rb, line 40
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
# File lib/spork/run_strategy/magazine.rb, line 95
95: def kill_all_processes
96:
97: @pids.each {|pid| Process.kill(9, pid)}
98: puts "\nKilling processes."; $stdout.flush
99: end
# File lib/spork/run_strategy/magazine.rb, line 112
112: def preload
113: true
114: # @test_framework.preload
115: end
# File lib/spork/run_strategy/magazine.rb, line 89
89: def restart_slave(id)
90: pid = @pids[id]
91: Process.kill(9, pid)
92: start_slave(id)
93: end
# File lib/spork/run_strategy/magazine.rb, line 68
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
# File lib/spork/run_strategy/magazine.rb, line 117
117: def running?
118: @running
119: end
# File lib/spork/run_strategy/magazine.rb, line 101
101: def slave_count
102: DRb.start_service
103: ts = Rinda::RingFinger.primary
104: ts.read_all([:name, :MagazineSlave, nil, nil]).size
105: end
# File lib/spork/run_strategy/magazine.rb, line 16
16: def slave_max
17: Slave_Id_Range.to_a.size
18: end
# File lib/spork/run_strategy/magazine.rb, line 56
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
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.