1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

make file uploads work via net-sftp v2

This commit is contained in:
Jamis Buck 2008-04-10 07:48:58 -06:00
parent f05ca93dcd
commit d817b60db0

View file

@ -56,11 +56,11 @@ module Capistrano
def process!
logger.debug "uploading #{filename}" if logger
while running?
sessions.each do |session|
@uploaders.each do |uploader|
begin
session.process(0)
uploader.sftp.session.process(0)
rescue Net::SFTP::StatusException => error
logger.important "uploading failed: #{error.description}", session.xserver if logger
logger.important "uploading failed: #{error.description}", uploader[:server] if logger
failed!(uploader)
end
end
@ -91,7 +91,10 @@ module Capistrano
real_filename = filename.gsub(/\$CAPISTRANO:HOST\$/, server.host)
logger.info "uploading data to #{server}:#{real_filename}" if logger
uploader = sftp.upload(StringIO.new(options[:data] || ""), real_filename, :permissions => options[:mode] || 0664)
uploader = sftp.upload(StringIO.new(options[:data] || ""), real_filename, :permissions => options[:mode] || 0664) do |event, actor, *args|
completed!(actor) if event == :finish
end
uploader[:server] = server
uploader[:done] = false