Class: CobraCommander::Executor::Context
- Inherits:
-
Object
- Object
- CobraCommander::Executor::Context
- Defined in:
- lib/cobra_commander/executor/context.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#component ⇒ Object
readonly
Returns the value of attribute component.
Instance Method Summary collapse
- #component_name ⇒ Object
-
#initialize(component, command) ⇒ Context
constructor
A new instance of Context.
- #output ⇒ Object
- #results ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(component, command) ⇒ Context
Returns a new instance of Context.
10 11 12 13 14 |
# File 'lib/cobra_commander/executor/context.rb', line 10 def initialize(component, command) @component = component @command = command @tty = TTY::Command.new(pty: true, printer: :null, stderr: :stdout) end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
8 9 10 |
# File 'lib/cobra_commander/executor/context.rb', line 8 def command @command end |
#component ⇒ Object (readonly)
Returns the value of attribute component.
8 9 10 |
# File 'lib/cobra_commander/executor/context.rb', line 8 def component @component end |
Instance Method Details
#component_name ⇒ Object
24 25 26 |
# File 'lib/cobra_commander/executor/context.rb', line 24 def component_name component.name end |
#output ⇒ Object
32 33 34 |
# File 'lib/cobra_commander/executor/context.rb', line 32 def output results.join("\n") end |
#results ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/cobra_commander/executor/context.rb', line 16 def results @results ||= @component.root_paths.map do |path| isolate_bundle do @tty.run!(command, chdir: path) end end end |
#success? ⇒ Boolean
28 29 30 |
# File 'lib/cobra_commander/executor/context.rb', line 28 def success? results.all?(&:success?) end |