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

allow $CAPISTRANO:HOST$ to be used in the filenames to the put command

git-svn-id: http://svn.rubyonrails.org/rails/tools/capistrano@7179 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jamis Buck 2007-07-11 13:17:47 +00:00
parent ce1f4733f3
commit b53072ef65
2 changed files with 9 additions and 5 deletions

View file

@ -1,5 +1,7 @@
*SVN*
* Allow $CAPISTRANO:HOST$ to be used in filenames to the put command [Jamis Buck]
* Allow execute_on_servers to be called without a current task again [Jamis Buck]
* Put $stdout in sync mode, so that Net::SSH prompts are displayed [Jamis Buck]

View file

@ -98,14 +98,16 @@ module Capistrano
sftp.channel[:server] = server
sftp.channel[:done] = false
sftp.channel[:failed] = false
sftp.open(filename, IO::WRONLY | IO::CREAT | IO::TRUNC, options[:mode] || 0660) do |status, handle|
break unless check_status(sftp, "open #{filename}", server, status)
logger.info "uploading data to #{server}:#{filename}" if logger
real_filename = filename.gsub(/\$CAPISTRANO:HOST\$/, server.host)
sftp.open(real_filename, IO::WRONLY | IO::CREAT | IO::TRUNC, options[:mode] || 0660) do |status, handle|
break unless check_status(sftp, "open #{real_filename}", server, status)
logger.info "uploading data to #{server}:#{real_filename}" if logger
sftp.write(handle, options[:data] || "") do |status|
break unless check_status(sftp, "write to #{server}:#{filename}", server, status)
break unless check_status(sftp, "write to #{server}:#{real_filename}", server, status)
sftp.close_handle(handle) do
logger.debug "done uploading data to #{server}:#{filename}" if logger
logger.debug "done uploading data to #{server}:#{real_filename}" if logger
completed!(sftp)
end
end