capistrano_rsync_with_remote_cache icon indicating copy to clipboard operation
capistrano_rsync_with_remote_cache copied to clipboard

Need to deploy from a git subdirectory (patch included)

Open ex-nerd opened this issue 15 years ago • 0 comments

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

ex-nerd avatar Nov 09 '10 00:11 ex-nerd