-
-
Save drbraden/3fb5f06e4fdf1ceb9e078b063da25e5b to your computer and use it in GitHub Desktop.
Capistrano strategy for checking out git projects locally rather than on deployment destination machine
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
module LocalGitStrategy | |
def test | |
run_locally do | |
test " [ -f #{repo_path}/.git/HEAD ] " | |
end | |
end | |
def check | |
run_locally do | |
execute :git, :'ls-remote --heads', repo_url | |
end | |
end | |
def clone | |
run_locally do | |
execute :git, :clone, repo_url, repo_path | |
end | |
end | |
def update | |
run_locally do | |
within repo_path do | |
execute :git, :remote, :update | |
end | |
end | |
end | |
def release | |
# no op | |
end | |
def fetch_revision | |
run_locally do | |
within repo_path do | |
capture(:git, :'rev-list', '--max-count=1', :'--abbrev-commit', "#{fetch(:branch)}") | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment