1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

Merge pull request #736 from mpapis/bugfix/allow_multiuser_deploy

move the git ssh helper to application path
This commit is contained in:
Tom Clements 2013-11-01 14:49:30 -07:00
commit 70f33517ed

View file

@ -1,15 +1,18 @@
namespace :git do
git_environmental_variables = {
git_askpass: "/bin/echo",
git_ssh: "#{fetch(:tmp_dir)}/git-ssh.sh"
set :git_environmental_variables, ->() {
{
git_askpass: "/bin/echo",
git_ssh: "#{fetch(:tmp_dir)}/#{fetch(:application)}/git-ssh.sh"
}
}
desc 'Upload the git wrapper script, this script guarantees that we can script git without getting an interactive prompt'
task :wrapper do
on roles :all do
upload! StringIO.new("#!/bin/sh -e\nexec /usr/bin/ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no \"$@\"\n"), "#{fetch(:tmp_dir)}/git-ssh.sh"
execute :chmod, "+x", "#{fetch(:tmp_dir)}/git-ssh.sh"
execute :mkdir, "-p", "#{fetch(:tmp_dir)}/#{fetch(:application)}/"
upload! StringIO.new("#!/bin/sh -e\nexec /usr/bin/ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no \"$@\"\n"), "#{fetch(:tmp_dir)}/#{fetch(:application)}/git-ssh.sh"
execute :chmod, "+x", "#{fetch(:tmp_dir)}/#{fetch(:application)}/git-ssh.sh"
end
end
@ -17,7 +20,7 @@ namespace :git do
task check: :'git:wrapper' do
fetch(:branch)
on roles :all do
with git_environmental_variables do
with fetch(:git_environmental_variables) do
exit 1 unless test :git, :'ls-remote', repo_url
end
end
@ -30,7 +33,7 @@ namespace :git do
info t(:mirror_exists, at: repo_path)
else
within deploy_path do
with git_environmental_variables do
with fetch(:git_environmental_variables) do
execute :git, :clone, '--mirror', repo_url, repo_path
end
end
@ -50,7 +53,7 @@ namespace :git do
desc 'Copy repo to releases'
task create_release: :'git:update' do
on roles :all do
with git_environmental_variables do
with fetch(:git_environmental_variables) do
within repo_path do
execute :mkdir, '-p', release_path
execute :git, :archive, fetch(:branch), '| tar -x -C', release_path