Skip to content
Browse files

make file uploads work via net-sftp v2

  • Loading branch information...
1 parent f05ca93 commit d817b60db0220aed715e4a561d87c9a74a889c2d @jamis jamis committed Apr 10, 2008
Showing with 7 additions and 4 deletions.
  1. +7 −4 lib/capistrano/upload.rb
View
11 lib/capistrano/upload.rb
@@ -56,11 +56,11 @@ def initialize(sessions, filename, options)
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 @@ def setup_uploaders
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

0 comments on commit d817b60

Please sign in to comment.
Something went wrong with that request. Please try again.