Class: Wizard::Spells::ExecuteShell
- Defined in:
- lib/wizard/spells/execute_shell.rb
Constant Summary
Constants included from Helpers
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize(command, options = {}) ⇒ ExecuteShell
constructor
A new instance of ExecuteShell.
- #perform ⇒ Object
Methods inherited from Base
all_forced?, attr_status, #force!, force_all!, #force_all!, #forced?, #status, #status?
Methods included from Helpers
#adjust, #colorize, #console_width, #print, #say, #say!
Constructor Details
#initialize(command, options = {}) ⇒ ExecuteShell
Returns a new instance of ExecuteShell.
8 9 10 11 |
# File 'lib/wizard/spells/execute_shell.rb', line 8 def initialize(command, ={}) @command = command @output = nil end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
5 6 7 |
# File 'lib/wizard/spells/execute_shell.rb', line 5 def command @command end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
5 6 7 |
# File 'lib/wizard/spells/execute_shell.rb', line 5 def output @output end |
Instance Method Details
#perform ⇒ Object
13 14 15 16 17 18 |
# File 'lib/wizard/spells/execute_shell.rb', line 13 def perform return executed! if @output = `#{command} 2>&1` and $?.exitstatus == 0 failed! rescue Object error! end |