Sha256: 377d1b7e21c7f7aead7f81a0e51f92d756d93c612728380c0b93a8d2e951f80a

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

require 'capistrano/recipes/deploy/strategy/remote'

module Capistrano
module Deploy
module Strategy

    # Implements the deployment strategy that keeps a cached copy.
    class CopyWithRemoteCache < Remote
        def deploy!
            update_repository_cache
            copy_repository_cache
        end

        def check!
            super.check do |d|
                d.remote.command("rsync")
                d.remote.writable(shared_path)
            end
        end

    private

        def repository_cache
            File.join(shared_path, configuration[:repository_cache] || "cached-copy")
        end

        def update_repository_cache
            logger.trace "updating the cached checkout"
            find_servers(:except => { :no_release => true }).each do |server|
                run_locally "rsync -rlz --delete -e ssh #{repository}/ #{server}:#{repository_cache}";
            end
        end

        def copy_repository_cache
            logger.trace "copying the cached version to #{configuration[:release_path]}"
            run "cp -RPp #{repository_cache} #{configuration[:release_path]} && #{mark}"
        end

    end

end
end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano_copy_with_remote_cache_strategy-0.1 lib/capistrano/recipes/deploy/strategy/copy_with_remote_cache.rb