Removed the class methods

This commit is contained in:
Arturo Pie 2011-06-01 16:45:31 -04:00
parent 7c001ab485
commit 3a613ef1b2
2 changed files with 9 additions and 11 deletions

View File

@ -16,7 +16,6 @@ module Hydra #:nodoc:
# Boot up a runner. It takes an IO object (generally a pipe from its
# parent) to send it messages on which files to execute.
def initialize(opts = {})
Runner.runner_instance = self # save Runner to make sure it stop at_exit
@io = opts.fetch(:io) { raise "No IO Object" }
@verbose = opts.fetch(:verbose) { false }
@event_listeners = Array( opts.fetch( :runner_listeners ) { nil } )
@ -25,6 +24,8 @@ module Hydra #:nodoc:
runner_begin
reg_exit_hook
trace 'Booted. Sending Request for file'
@io.write RequestFile.new
begin
@ -40,12 +41,11 @@ module Hydra #:nodoc:
@event_listeners.each {|l| l.runner_begin( self ) }
end
def self.runner_instance=( runner )
@runner_instance = runner
end
def self.runner_instance
@runner_instance
def reg_exit_hook
at_exit do
# NOTE: do not use trace here
stop
end
end
# Run a test file and report the results
@ -71,6 +71,7 @@ module Hydra #:nodoc:
# Stop running
def stop
# NOTE: do not use trace here
runner_end if @running
@running = false
end
@ -288,8 +289,4 @@ module Hydra #:nodoc:
end.compact
end
end
at_exit do
Runner.runner_instance.stop if Runner.runner_instance
end
end

View File

@ -10,6 +10,7 @@ module HydraExtension
class RunnerEndTest < Hydra::RunnerListener::Abstract
# Fired by the runner just after stoping
def runner_end( runner )
# NOTE: do not use trace here
FileUtils.touch File.expand_path(File.join(Dir.consistent_tmpdir, 'alternate_hydra_test.txt'))
end
end