class Aruba::CommandMonitor

@private
The command monitor is part of the private API of Aruba.

def all_output

Returns:
  • (String) -
def all_output
  all_stdout << all_stderr
end

def all_stderr

Returns:
  • (String) -
def all_stderr
  registered_commands.each(&:stop)
  registered_commands.each_with_object("") { |e, a| a << e.stderr }
end

def all_stdout

Returns:
  • (String) -
def all_stdout
  registered_commands.each(&:stop)
  registered_commands.each_with_object("") { |e, a| a << e.stdout }
end

def clear

Clear list of known commands
def clear
  registered_commands.each(&:terminate)
  registered_commands.clear
  self
end

def find(cmd)

Other tags:
    Yield: -
def find(cmd)
  cmd = cmd.commandline if cmd.respond_to? :commandline
  command = registered_commands.reverse.find { |c| c.commandline == cmd }
  raise CommandNotFoundError, "No command named '#{cmd}' has been started" if command.nil?
  command
end

def initialize(opts = {})

def initialize(opts = {})
  @registered_commands = []
  @announcer = opts.fetch(:announcer)
  @last_command_stopped = DefaultLastCommandStopped.new
  @last_command_started = DefaultLastCommandStarted.new
rescue KeyError => e
  raise ArgumentError, e.message
end

def last_command_started=(cmd)

Parameters:
  • cmd (String) --
def last_command_started=(cmd)
  @last_command_started = find(cmd)
end

def last_command_stopped=(cmd)

Parameters:
  • cmd (String) --
def last_command_stopped=(cmd)
  @last_command_stopped = find(cmd)
end

def register_command(cmd)

Register command to monitor
def register_command(cmd)
  registered_commands << cmd
  self
end