Class Capistrano::Deploy::Strategy::Copy
In: lib/capistrano/recipes/deploy/strategy/copy.rb
Parent: Base

This class implements the strategy for deployments which work by preparing the source code locally, compressing it, copying the file to each target host, and uncompressing it to the deployment directory.

By default, the SCM checkout command is used to obtain the local copy of the source code. If you would rather use the export operation, you can set the :copy_strategy variable to :export.

  set :copy_strategy, :export

For even faster deployments, you can set the :copy_cache variable to true. This will cause deployments to do a new checkout of your repository to a new directory, and then copy that checkout. Subsequent deploys will just resync that copy, rather than doing an entirely new checkout. Additionally, you can specify file patterns to exclude from the copy when using :copy_cache; just set the :copy_exclude variable to a file glob (or an array of globs).

  set :copy_cache, true
  set :copy_exclude, ".git/*"

Note that :copy_strategy is ignored when :copy_cache is set. Also, if you want the copy cache put somewhere specific, you can set the variable to the path you want, instead of merely ‘true’:

  set :copy_cache, "/tmp/caches/myapp"

This deployment strategy also supports a special variable, :copy_compression, which must be one of :gzip, :bz2, or :zip, and which specifies how the source should be compressed for transmission to each host.

There is a possibility to pass a build command that will get executed if your code needs to be compiled or something needs to be done before the code is ready to run.

  set :build_script, "make all"

Note that if you use :copy_cache, the :build_script is used on the cache and thus you get faster compilation if your script does not recompile everything.

Methods

build   check!   copy_cache   deploy!  

Constants

Compression = Struct.new(:extension, :compress_command, :decompress_command)   A struct for representing the specifics of a compression type. Commands are arrays, where the first element is the utility to be used to perform the compression or decompression.

Public Instance methods

Returns the location of the local copy cache, if the strategy should use a local cache + copy instead of a new checkout/export every time. Returns nil unless :copy_cache has been set. If :copy_cache is true, a default cache location will be returned.

Obtains a copy of the source code locally (via the command method), compresses it to a single file, copies that file to all target servers, and uncompresses it on each of them into the deployment directory.

[Validate]