Module: Capistrano::GitCopy::DefaultStrategy
- Defined in:
- lib/capistrano/gitcopy.rb
Instance Method Summary collapse
- #check ⇒ Object
- #clone ⇒ Object
- #fetch_revision ⇒ Object
- #local_tarfile ⇒ Object
- #release ⇒ Object
- #remote_tarfile ⇒ Object
- #test ⇒ Object
- #update ⇒ Object
Instance Method Details
#check ⇒ Object
22 23 24 |
# File 'lib/capistrano/gitcopy.rb', line 22 def check git :'ls-remote --heads', repo_url end |
#clone ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/capistrano/gitcopy.rb', line 26 def clone if (depth = fetch(:git_shallow_clone)) git :clone, '--verbose', '--mirror', '--depth', depth, '--no-single-branch', repo_url, repo_path else git :clone, '--verbose', '--mirror', repo_url, repo_path end end |
#fetch_revision ⇒ Object
43 44 45 |
# File 'lib/capistrano/gitcopy.rb', line 43 def fetch_revision context.capture(:git, "rev-list --max-count=1 --abbrev-commit --abbrev=12 #{fetch(:branch)}") end |
#local_tarfile ⇒ Object
47 48 49 |
# File 'lib/capistrano/gitcopy.rb', line 47 def local_tarfile "#{fetch(:tmp_dir)}/#{fetch(:application)}-#{fetch(:current_revision).strip}.tar.gz" end |
#release ⇒ Object
55 56 57 58 59 60 61 62 63 |
# File 'lib/capistrano/gitcopy.rb', line 55 def release if (tree = fetch(:repo_tree)) tree = tree.slice %r#^/?(.*?)/?$#, 1 components = tree.split('/').size git :archive, fetch(:branch), tree, '--format', 'tar', "|gzip > #{local_tarfile}" else git :archive, fetch(:branch), '--format', 'tar', "|gzip > #{local_tarfile}" end end |
#remote_tarfile ⇒ Object
51 52 53 |
# File 'lib/capistrano/gitcopy.rb', line 51 def remote_tarfile "#{fetch(:tmp_dir)}/#{fetch(:application)}-#{fetch(:current_revision).strip}.tar.gz" end |
#test ⇒ Object
18 19 20 |
# File 'lib/capistrano/gitcopy.rb', line 18 def test test! " [ -f #{repo_path}/HEAD ] " end |
#update ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/capistrano/gitcopy.rb', line 34 def update # Note: Requires git version 1.9 or greater if (depth = fetch(:git_shallow_clone)) git :fetch, '--depth', depth, 'origin', fetch(:branch) else git :remote, :update end end |