module Capistrano::RsyncScm::GitStrategy

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

Public Instance Methods

check() click to toggle source
# File lib/capistrano/rsync_scm.rb, line 12
def check
  `git ls-remote #{fetch(:repo_url)} refs/heads/#{fetch(:branch)} || true`.lines.any?
end
fetch_revision() click to toggle source
# File lib/capistrano/rsync_scm.rb, line 28
def fetch_revision
  `git rev-parse --short #{fetch(:branch)}`
end
with_clone(&block) click to toggle source
# File lib/capistrano/rsync_scm.rb, line 16
def with_clone(&block)
  tmpdir = Dir.mktmpdir('capistrano-rsync-scm-')
  begin
    run_locally do
      execute :git, 'clone', '--quiet', "--branch=#{fetch(:branch)}", fetch(:repo_url), tmpdir
    end
    block.call(tmpdir)
  ensure
    FileUtils.remove_entry(tmpdir)
  end
end