Class: EacRubyUtils::Envs::CompositeCommand

Inherits:
Object
  • Object
show all
Includes:
BaseCommand
Defined in:
lib/eac_ruby_utils/envs/composite_command.rb

Instance Method Summary collapse

Methods included from BaseCommand

#command

Instance Method Details

#bash_commandString

Returns:



27
28
29
30
# File 'lib/eac_ruby_utils/envs/composite_command.rb', line 27

def bash_command
  ['set', '-euo', 'pipefail', OPERATOR_BEFORE, left_command_line, operator,
   right_command_line].join(' ')
end

#command_line_without_env(_options = {}) ⇒ String

Returns:



22
23
24
# File 'lib/eac_ruby_utils/envs/composite_command.rb', line 22

def command_line_without_env(_options = {})
  ::Shellwords.join(['bash', '-c', bash_command])
end

#envEacRubyUtils::Envs::BaseEnv



19
# File 'lib/eac_ruby_utils/envs/composite_command.rb', line 19

delegate :env, to: :left_command

#left_command_lineObject



32
33
34
# File 'lib/eac_ruby_utils/envs/composite_command.rb', line 32

def left_command_line
  left_command.command_line_without_env
end

#right_command_lineObject



36
37
38
39
40
41
42
# File 'lib/eac_ruby_utils/envs/composite_command.rb', line 36

def right_command_line
  if right_command.env == left_command.env
    right_command.command_line_without_env
  else
    right_command.command
  end
end