module Capistrano::GitCopy::DefaultStrategy

Public Instance Methods

check() click to toggle source
# File lib/capistrano/gitcopy.rb, line 18
def check
  git :'ls-remote --heads', repo_url
end
clone() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# File lib/capistrano/gitcopy.rb, line 45
def local_tarfile
  "#{fetch(:tmp_dir)}/#{fetch(:application)}-#{fetch(:current_revision).strip}.tar.gz"
end
release() click to toggle source
# 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() click to toggle source
# 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() click to toggle source
# 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