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
- #update ⇒ Object
Instance Method Details
#check ⇒ Object
18 19 20 |
# File 'lib/capistrano/gitcopy.rb', line 18 def check git :'ls-remote --heads', repo_url end |
#clone ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/capistrano/gitcopy.rb', line 22 def clone local_path = fetch(:local_path) if (depth = fetch(:git_shallow_clone)) git :clone, '--verbose', '--mirror', '--depth', depth, '--no-single-branch', repo_url, local_path else git :clone, '--verbose', '--mirror', repo_url, local_path end end |
#fetch_revision ⇒ Object
41 42 43 |
# File 'lib/capistrano/gitcopy.rb', line 41 def fetch_revision context.capture(:git, "rev-list --max-count=1 --abbrev-commit --abbrev=12 #{fetch(:branch)}") end |
#local_tarfile ⇒ Object
45 46 47 |
# File 'lib/capistrano/gitcopy.rb', line 45 def local_tarfile "#{fetch(:tmp_dir)}/#{fetch(:application)}-#{fetch(:current_revision).strip}.tar.gz" end |
#release ⇒ Object
53 54 55 56 57 58 59 60 61 |
# File 'lib/capistrano/gitcopy.rb', line 53 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
49 50 51 |
# File 'lib/capistrano/gitcopy.rb', line 49 def remote_tarfile "#{fetch(:tmp_dir_remote, fetch(:tmp_dir))}/#{fetch(:application)}-#{fetch(:current_revision).strip}.tar.gz" end |
#update ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/capistrano/gitcopy.rb', line 32 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 |