Module: Capistrano::Git::PushStrategy

Defined in:
lib/capistrano/git/push_strategy.rb

Instance Method Summary collapse

Instance Method Details

#checkObject



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

def check
  run_locally do
    test 'git show-ref'
  end
end

#cloneObject



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

def clone
  git :init, '--bare', repo_path
end

#fetch_revisionObject



37
38
39
# File 'lib/capistrano/git/push_strategy.rb', line 37

def fetch_revision
  context.capture(:git, 'rev-parse --short master')
end

#releaseObject



33
34
35
# File 'lib/capistrano/git/push_strategy.rb', line 33

def release
  git :archive, 'master', '| tar -x -f - -C', release_path
end

#testObject



11
12
13
# File 'lib/capistrano/git/push_strategy.rb', line 11

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

#updateObject



25
26
27
28
29
30
31
# File 'lib/capistrano/git/push_strategy.rb', line 25

def update
  host = context.host

  run_locally do
    execute :git, :push, '--force', "#{host.user}@#{host.hostname}:#{repo_path} #{fetch(:branch)}:master"
  end
end