Class: DeepTest::Main

Inherits:
Object
  • Object
show all
Defined in:
lib/deep_test/main.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options, deployment, runner, central_command = nil) ⇒ Main

Returns a new instance of Main.



5
6
7
8
9
10
# File 'lib/deep_test/main.rb', line 5

def initialize(options, deployment, runner, central_command = nil)
  @options = options
  @deployment = deployment
  @runner = runner
  @central_command = central_command || CentralCommand.start(options)
end

Instance Attribute Details

#central_commandObject (readonly)

Returns the value of attribute central_command.



3
4
5
# File 'lib/deep_test/main.rb', line 3

def central_command
  @central_command
end

Instance Method Details

#load_files(files) ⇒ Object



12
13
14
# File 'lib/deep_test/main.rb', line 12

def load_files(files)
  @deployment.load_files files
end

#run(exit_when_done = true) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/deep_test/main.rb', line 16

def run(exit_when_done = true)
  passed = false

  begin
    @options.new_listener_list.before_starting_agents
    @deployment.deploy_agents
    begin
      DeepTest.logger.debug { "Main: About to process work units (#{$$})" }
      passed = @runner.process_work_units(central_command)
    ensure
      shutdown
    end
  ensure
    DeepTest.logger.debug { "Main: Stopping CentralCommand" }
    @central_command.stop
  end

  Kernel.exit(passed ? 0 : 1) if exit_when_done
end

#shutdownObject



36
37
38
39
# File 'lib/deep_test/main.rb', line 36

def shutdown
  DeepTest.logger.debug { "Main: Shutting Down" }
  @central_command.done_with_work
end