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:
parent
f05ca93dcd
commit
d817b60db0
1 changed files with 7 additions and 4 deletions
|
@ -56,11 +56,11 @@ module Capistrano
|
||||||
def process!
|
def process!
|
||||||
logger.debug "uploading #{filename}" if logger
|
logger.debug "uploading #{filename}" if logger
|
||||||
while running?
|
while running?
|
||||||
sessions.each do |session|
|
@uploaders.each do |uploader|
|
||||||
begin
|
begin
|
||||||
session.process(0)
|
uploader.sftp.session.process(0)
|
||||||
rescue Net::SFTP::StatusException => error
|
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)
|
failed!(uploader)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -91,7 +91,10 @@ module Capistrano
|
||||||
|
|
||||||
real_filename = filename.gsub(/\$CAPISTRANO:HOST\$/, server.host)
|
real_filename = filename.gsub(/\$CAPISTRANO:HOST\$/, server.host)
|
||||||
logger.info "uploading data to #{server}:#{real_filename}" if logger
|
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[:server] = server
|
||||||
uploader[:done] = false
|
uploader[:done] = false
|
||||||
|
|
Loading…
Reference in a new issue