Module: Vanagon::Utilities::ShellUtilities

Included in:
Component::Rules
Defined in:
lib/vanagon/utilities/shell_utilities.rb

Class Method Summary collapse

Class Method Details

.andand(*commands) ⇒ String

join a combination of strings and arrays of strings into a single command joined with ‘&&’

Parameters:

Returns:



11
12
13
# File 'lib/vanagon/utilities/shell_utilities.rb', line 11

def andand(*commands)
  cmdjoin(commands, " && ")
end

.andand_multiline(*commands) ⇒ String

join a combination of strings and arrays of strings into a single command joined with ‘&&’ and broken up with newlines after each ‘&&’

Parameters:

Returns:



20
21
22
# File 'lib/vanagon/utilities/shell_utilities.rb', line 20

def andand_multiline(*commands)
  cmdjoin(commands, " && \\\n")
end

.cmdjoin(commands, sep) ⇒ Object



24
25
26
# File 'lib/vanagon/utilities/shell_utilities.rb', line 24

def cmdjoin(commands, sep)
  commands.map { |o| Array(o) }.flatten.join(sep)
end