Class: Dk::Remote::CmdSpy

Inherits:
BaseCmd
  • Object
show all
Defined in:
lib/dk/remote.rb

Instance Attribute Summary collapse

Attributes inherited from BaseCmd

#cmd_str, #host_ssh_args, #hosts, #local_cmds, #ssh_args

Instance Method Summary collapse

Methods inherited from BaseCmd

#output_lines, #run, #ssh_cmd_str, #stderr, #stdout, #success?, #to_s

Constructor Details

#initialize(cmd_str, opts = nil) ⇒ CmdSpy

Returns a new instance of CmdSpy.



108
109
110
111
112
# File 'lib/dk/remote.rb', line 108

def initialize(cmd_str, opts = nil)
  super(Dk::Local::CmdSpy, cmd_str, opts)
  @cmd_opts = opts
  @first_local_cmd_spy = @local_cmds[@hosts.first]
end

Instance Attribute Details

#cmd_optsObject (readonly)

Returns the value of attribute cmd_opts.



106
107
108
# File 'lib/dk/remote.rb', line 106

def cmd_opts
  @cmd_opts
end

Instance Method Details

#exitstatus=(value) ⇒ Object



122
# File 'lib/dk/remote.rb', line 122

def exitstatus=(value); @first_local_cmd_spy.exitstatus = value; end

#run_called?Boolean

Returns:

  • (Boolean)


126
# File 'lib/dk/remote.rb', line 126

def run_called?; @first_local_cmd_spy.scmd.start_called?; end

#run_callsObject

just query the firs tlocal cmd - if run for one it was run for all



125
# File 'lib/dk/remote.rb', line 125

def run_calls;   @first_local_cmd_spy.scmd.start_calls;   end

#run_inputObject



114
115
116
117
# File 'lib/dk/remote.rb', line 114

def run_input
  return nil unless self.run_called?
  self.run_calls.first.input
end

#ssh?Boolean

Returns:

  • (Boolean)


128
# File 'lib/dk/remote.rb', line 128

def ssh?; true; end

#stderr=(value) ⇒ Object



121
# File 'lib/dk/remote.rb', line 121

def stderr=(value);     @first_local_cmd_spy.stderr     = value; end

#stdout=(value) ⇒ Object

just set the first local cmd, this will have an overall effect



120
# File 'lib/dk/remote.rb', line 120

def stdout=(value);     @first_local_cmd_spy.stdout     = value; end