lib/capistrano/bundle_rsync/git.rb in capistrano-bundle_rsync-0.3.3 vs lib/capistrano/bundle_rsync/git.rb in capistrano-bundle_rsync-0.4.0
- old
+ new
@@ -22,10 +22,16 @@
def create_release
execute "mkdir -p #{config.local_release_path}"
within config.local_mirror_path do
- execute :git, :archive, fetch(:branch), '| tar -x -C', "#{config.local_release_path}"
+ if tree = fetch(:repo_tree)
+ stripped = tree.slice %r#^/?(.*?)/?$#, 1 # strip both side /
+ num_components = stripped.count('/')
+ execute :git, :archive, fetch(:branch), tree, "| tar -x --strip-components #{num_components} -f - -C ", "#{config.local_release_path}"
+ else
+ execute :git, :archive, fetch(:branch), '| tar -x -C', "#{config.local_release_path}"
+ end
end
end
def rsync_release
hosts = release_roles(:all)