Sha256: a681c4ae9e226b9adf7b4b2399d75be0c0c0e00a81a3cf11f1c0eb6935df1cc6
Contents?: true
Size: 1009 Bytes
Versions: 2
Compression:
Stored size: 1009 Bytes
Contents
# frozen_string_literal: true require "tty-command" module CobraCommander module Executor # Represents a component context to execute a command # @private class Context attr_reader :component, :command def initialize(component, command) @component = component @command = command @tty = TTY::Command.new(pty: true, printer: :null, stderr: :stdout) end def results @results ||= @component.root_paths.map do |path| isolate_bundle do @tty.run!(command, chdir: path) end end end def component_name component.name end def success? results.all?(&:success?) end def output results.join("\n") end private def isolate_bundle(&block) if Bundler.respond_to?(:with_unbundled_env) Bundler.with_unbundled_env(&block) else Bundler.with_clean_env(&block) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cobra_commander-0.15.1 | lib/cobra_commander/executor/context.rb |
cobra_commander-0.15.0 | lib/cobra_commander/executor/context.rb |