Created
March 11, 2014 23:01
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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