Implements the deployment strategy that keeps a cached checkout of the source code on each remote server. Each deploy simply updates the cached checkout, and then does a copy from the cached copy to the final deployment location.
# File lib/capistrano/recipes/deploy/strategy/remote_cache.rb, line 19 19: def check! 20: super.check do |d| 21: d.remote.command("rsync") unless copy_exclude.empty? 22: d.remote.writable(shared_path) 23: end 24: end
Executes the SCM command for this strategy and writes the REVISION mark file to each host.
# File lib/capistrano/recipes/deploy/strategy/remote_cache.rb, line 14 14: def deploy! 15: update_repository_cache 16: copy_repository_cache 17: end
# File lib/capistrano/recipes/deploy/strategy/remote_cache.rb, line 50 50: def copy_exclude 51: @copy_exclude ||= Array(configuration.fetch(:copy_exclude, [])) 52: end
# File lib/capistrano/recipes/deploy/strategy/remote_cache.rb, line 40 40: def copy_repository_cache 41: logger.trace "copying the cached version to #{configuration[:release_path]}" 42: if copy_exclude.empty? 43: run "cp -RPp #{repository_cache} #{configuration[:release_path]} && #{mark}" 44: else 45: exclusions = copy_exclude.map { |e| "--exclude=\"#{e}\"" }.join(' ') 46: run "rsync -lrpt #{exclusions} #{repository_cache}/ #{configuration[:release_path]} && #{mark}" 47: end 48: end
# File lib/capistrano/recipes/deploy/strategy/remote_cache.rb, line 28 28: def repository_cache 29: File.join(shared_path, configuration[:repository_cache] || "cached-copy") 30: end
# File lib/capistrano/recipes/deploy/strategy/remote_cache.rb, line 32 32: def update_repository_cache 33: logger.trace "updating the cached checkout on all servers" 34: command = "if [ -d #{repository_cache} ]; then " + 35: "#{source.sync(revision, repository_cache)}; " + 36: "else #{source.checkout(revision, repository_cache)}; fi" 37: scm_run(command) 38: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.