Class: EacRubyUtils::Envs::Command

Inherits:
Object
  • Object
show all
Includes:
BaseCommand
Defined in:
lib/eac_ruby_utils/envs/command.rb,
lib/eac_ruby_utils/envs/command/envvars.rb,
lib/eac_ruby_utils/envs/command/extra_options.rb

Direct Known Subclasses

Ruby::Command

Defined Under Namespace

Modules: Envvars, ExtraOptions

Class Method Summary collapse

Instance Method Summary collapse

Methods included from BaseCommand

#command, #env

Class Method Details

.sanitize_initialize_arguments(arguments) ⇒ Array

Parameters:

  • command (Array)

Returns:

  • (Array)


15
16
17
18
19
20
21
22
23
# File 'lib/eac_ruby_utils/envs/command.rb', line 15

def sanitize_initialize_arguments(arguments)
  if arguments.count == 1 && arguments.first.is_a?(Array)
    arguments.first
  elsif arguments.is_a?(Array)
    arguments
  else
    raise "Invalid argument command: #{arguments}|#{arguments.class}"
  end
end

Instance Method Details

#append(args) ⇒ Object



31
32
33
# File 'lib/eac_ruby_utils/envs/command.rb', line 31

def append(args)
  duplicate_by_command(self.args + args)
end

#command_line_without_envString

Returns:



44
45
46
47
48
# File 'lib/eac_ruby_utils/envs/command.rb', line 44

def command_line_without_env
  c = args
  c = c.map { |x| escape(x) }.join(' ') if c.is_a?(Enumerable)
  append_chdir(append_envvars(c))
end

#prepend(args) ⇒ Object



35
36
37
# File 'lib/eac_ruby_utils/envs/command.rb', line 35

def prepend(args)
  duplicate_by_command(args + self.args)
end

#to_sObject



39
40
41
# File 'lib/eac_ruby_utils/envs/command.rb', line 39

def to_s
  "#{args} [ENV: #{env}]"
end