Skip to content

Instantly share code, notes, and snippets.

@megahbite
Created March 11, 2014 23:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save megahbite/9496837 to your computer and use it in GitHub Desktop.
Save megahbite/9496837 to your computer and use it in GitHub Desktop.
Capistrano 3 task for deploying on a server that has no outgoing SSH access to a repository
namespace :local_repo do
desc "Upload and deploy code from local copy of repo"
task :upload do
run_locally do
execute :rm, '-rf', 'repo.git'
execute :git, :clone, '--bare', '--single-branch', "-b #{fetch(:branch)}", ".", "repo.git"
execute :tar, '-czvf', 'repo.tar.gz', 'repo.git'
end
on roles(:app) do
upload! 'repo.tar.gz', '/tmp'
within('/tmp') do
execute :rm, '-rf', 'repo.git'
execute :tar, '-xvzf', 'repo.tar.gz'
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment