Skip to content

Commit

Permalink
Allow specifying copy method
Browse files Browse the repository at this point in the history
  • Loading branch information
duien authored and leehambley committed Oct 16, 2009
1 parent 312b373 commit 62b8f7a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/capistrano/recipes/deploy/strategy/copy.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ module Strategy
# :copy_compression, which must be one of :gzip, :bz2, or # :copy_compression, which must be one of :gzip, :bz2, or
# :zip, and which specifies how the source should be compressed for # :zip, and which specifies how the source should be compressed for
# transmission to each host. # transmission to each host.
#
# It also supports the variable :copy_via, which must be one of :sftp or
# :scp, and which specifies the method used to transfer the compressed
# code to the remote server. It defaults to :sftp.
class Copy < Base class Copy < Base
# Obtains a copy of the source code locally (via the #command method), # Obtains a copy of the source code locally (via the #command method),
# compresses it to a single file, copies that file to all target # compresses it to a single file, copies that file to all target
Expand Down Expand Up @@ -96,7 +100,8 @@ def deploy!
logger.trace "compressing #{destination} to #{filename}" logger.trace "compressing #{destination} to #{filename}"
Dir.chdir(tmpdir) { system(compress(File.basename(destination), File.basename(filename)).join(" ")) } Dir.chdir(tmpdir) { system(compress(File.basename(destination), File.basename(filename)).join(" ")) }


upload(filename, remote_filename) upload(filename, remote_filename, {:via => configuration[:copy_via]})
# FIXED Allow specifying transfer mode
run "cd #{configuration[:releases_path]} && #{decompress(remote_filename).join(" ")} && rm #{remote_filename}" run "cd #{configuration[:releases_path]} && #{decompress(remote_filename).join(" ")} && rm #{remote_filename}"
ensure ensure
FileUtils.rm filename rescue nil FileUtils.rm filename rescue nil
Expand Down

0 comments on commit 62b8f7a

Please sign in to comment.