Class: Capistrano::Deploy::Strategy::RemoteCacheWithProjectRoot

Inherits:
RemoteCache
  • Object
show all
Defined in:
lib/capistrano/recipes/deploy/strategy/remote_cache_with_project_root.rb

Overview

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.

it needs a “set :project_root, ‘path_to_the_app’” call in your deploy.rb

Constant Summary collapse

VERSION =
"0.0.2"

Instance Method Summary collapse

Instance Method Details

#copy_repository_cacheObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/capistrano/recipes/deploy/strategy/remote_cache_with_project_root.rb', line 18

def copy_repository_cache
  
   cached_project_root = File.join(repository_cache, project_root)
   
   logger.trace "copying the cached version from #{cached_project_root} to #{configuration[:release_path]}"

   
   if copy_exclude.empty? 
     run "cp -RPp #{cached_project_root} #{configuration[:release_path]} && #{mark}"
   else
     run "mkdir -p #{configuration[:release_path]}"
     exclusions = copy_exclude.map { |e| "--exclude=\"#{e}\"" }.join(' ')
     run "rsync -lrpt #{exclusions} #{cached_project_root}/* #{configuration[:release_path]} && #{mark}"
   end
end