capistrano_rsync_with_remote_cache
capistrano_rsync_with_remote_cache copied to clipboard
Need to deploy from a git subdirectory (patch included)
I have a need to deploy only a subtree from a git checkout. There is some churn in the upstream capistrano project about doing this, but it's enough for my needs to just adjust the path that rsync_with_remote_cache pulls from. I'm attaching my patch below, in case you're interested.
index ad44c22..a30fcaa 100644
--- rsync_with_remote_cache.rb
+++ rsync_with_remote_cache.rb
@@ -44,7 +44,12 @@ module Capistrano
end
def rsync_command_for(server)
- "rsync #{rsync_options} --rsh='ssh -p #{ssh_port(server)}' #{local_cache_path}/ #{rsync_host(server)}:#{repository_cache_path}/"
+ if configuration[:app_root].nil? || configuration[:app_root].empty?
+ path = local_cache_path
+ else
+ path = "#{local_cache_path}/#{configuration[:app_root]}"
+ end
+ "rsync #{rsync_options} --rsh='ssh -p #{ssh_port(server)}' #{path}/ #{rsync_host(server)}:#{repository_cache_path}/"
end
def mark_local_cache