Sha256: 3abe5b024cf4532aa65e8b48f4478e7e8f1806f448d42cba389877b65817c42c
Contents?: true
Size: 1.17 KB
Versions: 70
Compression:
Stored size: 1.17 KB
Contents
# frozen_string_literal: true require 'eac_ruby_utils/core_ext' require 'eac_ruby_utils/envs/base_command' module EacRubyUtils module Envs class CompositeCommand include ::EacRubyUtils::Envs::BaseCommand enable_listable lists.add_string :operator, '&&' => :and, ';' => :before, '||' => :or, '|' => :pipe common_constructor :operator, :left_command, :right_command do self.operator = self.class.lists.operator.value_validate!(operator.to_s) end # @return [EacRubyUtils::Envs::BaseEnv] delegate :env, to: :left_command # @return [String] def command_line_without_env(_options = {}) ::Shellwords.join(['bash', '-c', bash_command]) end # @return [String] def bash_command ['set', '-euo', 'pipefail', OPERATOR_BEFORE, left_command_line, operator, right_command_line].join(' ') end def left_command_line left_command.command_line_without_env end def right_command_line if right_command.env == left_command.env right_command.command_line_without_env else right_command.command end end end end end
Version data entries
70 entries across 70 versions & 2 rubygems