Class: Kumade::CommandLine

Inherits:
Object
  • Object
show all
Defined in:
lib/kumade/command_line.rb

Instance Method Summary collapse

Constructor Details

#initialize(command_to_run) ⇒ CommandLine

Returns a new instance of CommandLine.



5
6
7
# File 'lib/kumade/command_line.rb', line 5

def initialize(command_to_run)
  @command_line = Cocaine::CommandLine.new(command_to_run)
end

Instance Method Details

#runObject



18
19
20
21
22
23
24
# File 'lib/kumade/command_line.rb', line 18

def run
  begin
    @command_line.run
  rescue Cocaine::ExitStatusError, Cocaine::CommandNotFoundError
    false
  end
end

#run_or_error(error_message = nil) ⇒ Object



9
10
11
# File 'lib/kumade/command_line.rb', line 9

def run_or_error(error_message = nil)
  run_with_status || Kumade.configuration.outputter.error(error_message)
end

#run_with_statusObject



13
14
15
16
# File 'lib/kumade/command_line.rb', line 13

def run_with_status
  Kumade.configuration.outputter.say_command(command)
  Kumade.configuration.pretending? || run
end