Method: Aruba::Command#initialize

Defined in:
lib/aruba/command.rb

#initialize(command, opts = {}) ⇒ Command

Returns a new instance of Command.



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/aruba/command.rb', line 27

def initialize(command, opts = {})
  launchers = []
  launchers << Processes::DebugProcess
  launchers << Processes::InProcess
  launchers << Processes::SpawnProcess

  klass = launchers.find { |l| l.match? opts[:mode] }

  launcher = klass.new(
    command,
    opts.fetch(:exit_timeout),
    opts.fetch(:io_wait_timeout),
    opts.fetch(:working_directory),
    opts.fetch(:environment),
    opts.fetch(:main_class),
    opts.fetch(:stop_signal),
    opts.fetch(:startup_wait_time)
  )

  super(launcher)

  @event_bus = opts.fetch(:event_bus)
rescue KeyError => e
  raise ArgumentError, e.message
end