lib/pushwagner/hooks.rb in pushwagner-0.0.1.10 vs lib/pushwagner/hooks.rb in pushwagner-0.0.1.11
- old
+ new
@@ -32,11 +32,11 @@
end
class Hooks::Remote
- attr_reader :environment, :before, :after
+ attr_reader :environment, :before, :after, :sudo
def initialize(env, remote)
@environment = env
@before = remote['before'] || []
@@ -82,15 +82,20 @@
ssh.open_channel do |ch|
ch.request_pty do |pty_ch, success|
raise "could not execute #{cmd}" unless success
+ puts
+
ch.exec("#{cmd}")
ch.on_data do |data_ch, data|
if data =~ /\[sudo\] password/i
- ch.send_data("#{gets_sudo_passwd}\n")
+ gets_sudo_passwd unless sudo
+ ch.send_data("#{sudo}\n")
+ else
+ print data
end
end
end
end
@@ -128,6 +133,7 @@
end
end
end
-end
\ No newline at end of file
+end
+