Class: Battlestation::Operations::Runner
- Defined in:
- lib/battlestation/operations/runner.rb
Instance Attribute Summary collapse
-
#cmd ⇒ Object
Returns the value of attribute cmd.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(cmd, opts = {}) ⇒ Runner
constructor
A new instance of Runner.
- #status ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(cmd, opts = {}) ⇒ Runner
Returns a new instance of Runner.
6 7 8 9 10 11 |
# File 'lib/battlestation/operations/runner.rb', line 6 def initialize(cmd, opts = {}) @cmd = cmd @type = :runner @name = "runner-#{cmd.split(" ").first}" @opts = opts end |
Instance Attribute Details
#cmd ⇒ Object
Returns the value of attribute cmd.
4 5 6 |
# File 'lib/battlestation/operations/runner.rb', line 4 def cmd @cmd end |
Instance Method Details
#status ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/battlestation/operations/runner.rb', line 13 def status Battlestation.ui.notice "Executing `#{cmd}`" if system("#{cmd} &> /dev/null") { status: :okay, msg: "`#{cmd}` executed successfully", name: name } else { status: :fail, msg: "`#{cmd}` failed to execute", name: name } end end |