Class: CobraCommander::Executor::ComponentExec

Inherits:
Object
  • Object
show all
Defined in:
lib/cobra_commander/executor/component_exec.rb

Overview

Execute a command on a single component

Instance Method Summary collapse

Constructor Details

#initialize(component) ⇒ ComponentExec



9
10
11
# File 'lib/cobra_commander/executor/component_exec.rb', line 9

def initialize(component)
  @component = component
end

Instance Method Details

#run(command, output: $stdout, **cmd_options) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/cobra_commander/executor/component_exec.rb', line 13

def run(command, output: $stdout, **cmd_options)
  tty = TTY::Command.new(pty: true, printer: :quiet, output: output)
  Bundler.with_original_env do
    @component.root_paths.all? do |path|
      tty.run!(command, chdir: path, **cmd_options).success?
    end
  end
end