class Capistrano::Deploy::Strategy::AdvanceRemoteCache

Public Instance Methods

check!() click to toggle source
Calls superclass method
# File lib/capistrano/recipes/deploy/strategy/advance_remote_cache.rb, line 14
def check!
  super.check do |d|
    d.remote.writable(shared_path)
  end
end
deploy!() click to toggle source
# File lib/capistrano/recipes/deploy/strategy/advance_remote_cache.rb, line 9
def deploy!
  update_repository_cache
  copy_repository_cache
end

Private Instance Methods

copy_repository_cache() click to toggle source
# File lib/capistrano/recipes/deploy/strategy/advance_remote_cache.rb, line 45
def copy_repository_cache
  logger.trace "copying the cached version to #{configuration[:release_path]}"
  scm_run "if [ ! -d #{configuration[:release_path]} ]; then mkdir -p #{configuration[:release_path]}; fi"
  run "cd #{repository_cache} && git archive #{revision} | tar -x -f - -C #{configuration[:release_path]} && #{mark}"
end
repository_cache() click to toggle source
# File lib/capistrano/recipes/deploy/strategy/advance_remote_cache.rb, line 22
def repository_cache
  File.join(shared_path, configuration[:repository_cache] || "cached-copy")
end
update_repository_cache() click to toggle source
# File lib/capistrano/recipes/deploy/strategy/advance_remote_cache.rb, line 26
def update_repository_cache
  logger.trace "updating the cached checkout on all servers"

  # command = "if [ -d #{repository_cache} ]; then " +
  #   "#{source.sync(revision, repository_cache)}; " +
  #   "else #{source.checkout(revision, repository_cache)}; fi"
  # scm_run command

  command = "if [ -d #{repository_cache} ]; then " +
    "cd #{repository_cache} && " +
    "git remote update --prune && " +
    "git fetch -v #{source.origin} #{revision} && " +
    "git reset --hard #{revision} && " +
    "git clean -d -x -f; " +
    "else #{source.checkout(revision, repository_cache)}; fi"

  scm_run(command)
end