Class: Kumade::CommandLine
- Inherits:
-
Object
- Object
- Kumade::CommandLine
- Defined in:
- lib/kumade/command_line.rb
Instance Method Summary collapse
-
#initialize(command_to_run) ⇒ CommandLine
constructor
A new instance of CommandLine.
- #run ⇒ Object
- #run_or_error(error_message = nil) ⇒ Object
- #run_with_status ⇒ Object
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
#run ⇒ Object
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( = nil) run_with_status || Kumade.configuration.outputter.error() end |
#run_with_status ⇒ Object
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 |