Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #1: Fix handling of default options #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 18 additions & 13 deletions lib/capistrano/rsync.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,13 @@
# private API and internals of Capistrano::Rsync. If you think something should
# be public for extending and hooking, please let me know!

set :rsync_options, []
set :rsync_copy, "rsync --archive --acls --xattrs"

# Stage is used on your local machine for rsyncing from.
set :rsync_stage, "tmp/deploy"

# Cache is used on the server to copy files to from to the release directory.
# Saves you rsyncing your whole app folder each time. If you nil rsync_cache,
# Capistrano::Rsync will sync straight to the release path.
set :rsync_cache, "shared/deploy"

rsync_cache = lambda do
cache = fetch(:rsync_cache)
cache = deploy_to + "/" + cache if cache && cache !~ /^\//
cache
end

Rake::Task["load:defaults"].enhance ["rsync:defaults"]
Rake::Task["deploy:check"].enhance ["rsync:hook_scm"]
Rake::Task["deploy:updating"].enhance ["rsync:hook_scm"]

Expand All @@ -40,13 +30,28 @@
end

namespace :rsync do

desc "Load rsync default options."
task :defaults do
set :rsync_options, %w[--recursive --delete --delete-excluded --exclude .git*]
set :rsync_copy, "rsync --archive --acls --xattrs"

# Stage is used on your local machine for rsyncing from.
set :rsync_stage, "tmp/deploy"

# Cache is used on the server to copy files to from to the release
# directory. Saves you rsyncing your whole app folder each time. If you nil
# rsync_cache, Capistrano::Rsync will sync straight to the release path.
set :rsync_cache, "shared/deploy"
end

task :hook_scm do
Rake::Task.define_task("#{scm}:check") do
invoke "rsync:check"
invoke "rsync:check"
end

Rake::Task.define_task("#{scm}:create_release") do
invoke "rsync:release"
invoke "rsync:release"
end
end

Expand Down