41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/fulmar/shell.rb', line 41
def run(command, options = DEFAULT_OPTIONS)
reset_output(@last_output.max_size)
command = [command] if command.class == String
path = if options[:in]
(Pathname.new options[:in]).absolute? ? options[:in] : "#{@path}/#{options[:in]}"
else
@path
end
options[:error_message] ||= 'Last shell command returned an error.'
command.unshift "cd \"#{path}\""
shell_command = shell_command(options[:login])
@clean_environment << 'bundler' if options[:escape_bundler]
if local?
execute("#{shell_command} '#{escape_for_sh(command.join(' && '))}'", options[:error_message])
else
remote_command = escape_for_sh("#{shell_command} '#{escape_for_sh(command.join(' && '))}'")
execute("ssh #{@host} '#{remote_command}'", options[:error_message])
end
end
|