Class: CapUtil::LocalCmdRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/cap-util/local_cmd_runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(cmd_str) ⇒ LocalCmdRunner

Returns a new instance of LocalCmdRunner.



8
9
10
# File 'lib/cap-util/local_cmd_runner.rb', line 8

def initialize(cmd_str)
  @cmd = Scmd.new(cmd_str)
end

Instance Method Details

#run!(input = nil) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/cap-util/local_cmd_runner.rb', line 12

def run!(input = nil)
  CapUtil.say_bulleted "running `#{@cmd}'"
  @cmd.run(input)

  if !@cmd.success?
    CapUtil.say_error(@cmd.stderr)
    CapUtil.halt
  end
  @cmd
end