lib/cobra_commander/executor.rb in cobra_commander-0.11.0 vs lib/cobra_commander/executor.rb in cobra_commander-0.12.0

- old
+ new

@@ -1,19 +1,14 @@ # frozen_string_literal: true -require_relative "executor/component_exec" -require_relative "executor/multi_exec" +require_relative "executor/context" +require_relative "executor/concurrent" module CobraCommander - # Execute commands on all components of a ComponentTree + # Execute a command on all given components module Executor - def self.exec(components:, command:, concurrency:, output: $stdout, status_output: $stderr) - components = Array(components) - exec = if components.size == 1 - ComponentExec.new(components.first) - else - MultiExec.new(components, concurrency: concurrency, spin_output: status_output) - end - exec.run(command, output: output) + def self.exec(components:, command:, concurrency:, status_output:) + Concurrent.new(components, concurrency: concurrency, spin_output: status_output) + .exec(command) end end end