Module: Capistrano::Git::DefaultStrategy

Defined in:
lib/capistrano/git.rb

Overview

The Capistrano default strategy for git. You should want to use this.

Instance Method Summary collapse

Instance Method Details

#checkObject



20
21
22
# File 'lib/capistrano/git.rb', line 20

def check
  git :'ls-remote --heads', repo_url
end

#cloneObject



24
25
26
# File 'lib/capistrano/git.rb', line 24

def clone
  git :clone, '--mirror', repo_url, repo_path
end

#fetch_revisionObject



42
43
44
# File 'lib/capistrano/git.rb', line 42

def fetch_revision
  context.capture(:git, "rev-parse --short #{fetch(:branch)}")
end

#releaseObject



32
33
34
35
36
37
38
39
40
# File 'lib/capistrano/git.rb', line 32

def release
  if tree = fetch(:repo_tree)
    tree = tree.slice %r#^/?(.*?)/?$#, 1
    components = tree.split('/').size
    git :archive, fetch(:branch), tree, "| tar -x --strip-components #{components} -f - -C", release_path
  else
    git :archive, fetch(:branch), '| tar -x -f - -C', release_path
  end
end

#testObject



16
17
18
# File 'lib/capistrano/git.rb', line 16

def test
  test! " [ -f #{repo_path}/HEAD ] "
end

#updateObject



28
29
30
# File 'lib/capistrano/git.rb', line 28

def update
  git :remote, :update
end