lib/ors/helpers.rb in ors-0.2.2 vs lib/ors/helpers.rb in ors-0.2.3
- old
+ new
@@ -81,10 +81,11 @@
# options = {:exec => ?, :capture => ?}
def execute_command server, *command_array
options = {:exec => false, :capture => false}
options.merge!(command_array.pop) if command_array.last.is_a?(Hash)
+ options[:local] = true if server.to_s == "localhost"
command = build_command(server, command_array, options)
if pretending
info("[#{server}] #{command}")
@@ -116,13 +117,17 @@
end
commands = command_array.join " && "
psuedo_tty = options[:exec] ? '-t ' : ''
- if use_gateway
- %(ssh #{psuedo_tty}#{gateway} 'ssh #{psuedo_tty}#{deploy_user}@#{server} "#{commands}"')
+ if options[:local]
+ commands
else
- %(ssh #{psuedo_tty}#{deploy_user}@#{server} "#{commands}")
+ if use_gateway
+ %(ssh #{psuedo_tty}#{gateway} 'ssh #{psuedo_tty}#{deploy_user}@#{server} "#{commands}"')
+ else
+ %(ssh #{psuedo_tty}#{deploy_user}@#{server} "#{commands}")
+ end
end
end
def info message
STDOUT.puts message