Advertisement
Guest User

Untitled

a guest
Jul 16th, 2019
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. # this include won't work for some reason:
  2. # include Capistrano::Git::DefaultStrategy
  3.  
  4. module SubmoduleStrategy
  5.  
  6. # check for a .git directory
  7. def test
  8. test! " [ -d #{repo_path}/.git ] "
  9. end
  10.  
  11. # same as in Capistrano::Git::DefaultStrategy
  12. def check
  13. test! :git, :'ls-remote', repo_url
  14. end
  15.  
  16. def clone
  17. git :clone, '-b', fetch(:branch), '--recursive', repo_url, repo_path
  18. end
  19.  
  20. # same as in Capistrano::Git::DefaultStrategy
  21. def update
  22. git :remote, :update
  23. end
  24.  
  25. # put the working tree in a release-branch,
  26. # make sure the submodules are up-to-date
  27. # and copy everything to the release path
  28. def release
  29. release_branch = fetch(:release_branch, File.basename(release_path))
  30. git :checkout, '-b', release_branch, fetch(:remote_branch, "origin/#{fetch(:branch)}")
  31. git :submodule, :update, '--init'
  32. context.execute "rsync -ar --exclude=.git\* #{repo_path}/ #{release_path}"
  33. end
  34.  
  35. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement