Class: Paratrooper::SystemCaller
- Inherits:
-
Object
- Object
- Paratrooper::SystemCaller
- Defined in:
- lib/paratrooper/system_caller.rb
Defined Under Namespace
Classes: ErrorSystemExit
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
Instance Method Summary collapse
- #execute(cmd, exit_code = false) ⇒ Object
-
#initialize(debug = false) ⇒ SystemCaller
constructor
A new instance of SystemCaller.
Constructor Details
#initialize(debug = false) ⇒ SystemCaller
Returns a new instance of SystemCaller.
13 14 15 |
# File 'lib/paratrooper/system_caller.rb', line 13 def initialize(debug = false) @debug = debug end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
11 12 13 |
# File 'lib/paratrooper/system_caller.rb', line 11 def debug @debug end |
Instance Method Details
#execute(cmd, exit_code = false) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/paratrooper/system_caller.rb', line 17 def execute(cmd, exit_code = false) (cmd) result = %x[#{cmd}] if exit_code && $? != 0 fail(ErrorSystemExit.new(cmd)) end result end |