module Capistrano::Git::DefaultStrategy

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

Public Instance Methods

check() click to toggle source
# File lib/capistrano/git.rb, line 19
def check
  git :'ls-remote --heads', repo_url
end
clone() click to toggle source
# File lib/capistrano/git.rb, line 23
def clone
  if (depth = fetch(:git_shallow_clone))
    git :clone, "--mirror", "--depth", depth, "--no-single-branch", repo_url, repo_path
  else
    git :clone, "--mirror", repo_url, repo_path
  end
end
fetch_revision() click to toggle source
# File lib/capistrano/git.rb, line 50
def fetch_revision
  context.capture(:git, "rev-list --max-count=1 #{fetch(:branch)}")
end
release() click to toggle source
# File lib/capistrano/git.rb, line 40
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
test() click to toggle source
# File lib/capistrano/git.rb, line 15
def test
  test! " [ -f #{repo_path}/HEAD ] "
end
update() click to toggle source
# File lib/capistrano/git.rb, line 31
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, "--prune"
  end
end