Class: Capistrano::Rsync::Scm::Git

Inherits:
Base
  • Object
show all
Defined in:
lib/capistrano/rsync/scm/git.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Capistrano::Rsync::Scm::Base

Instance Attribute Details

#contextObject (readonly)

Returns the value of attribute context.



6
7
8
# File 'lib/capistrano/rsync/scm/git.rb', line 6

def context
  @context
end

Instance Method Details

#create_stage_cmdsObject



12
13
14
15
16
17
18
19
# File 'lib/capistrano/rsync/scm/git.rb', line 12

def create_stage_cmds
  cmd = []
  clone = %W[git clone]
  clone << context.fetch(:repo_url, ".")
  clone << context.fetch(:rsync_stage)
  cmd << clone
  cmd
end

#get_current_revision_cmdObject



8
9
10
# File 'lib/capistrano/rsync/scm/git.rb', line 8

def get_current_revision_cmd
  "git rev-parse HEAD"
end

#update_stage_cmdsObject



21
22
23
24
25
26
27
28
# File 'lib/capistrano/rsync/scm/git.rb', line 21

def update_stage_cmds
  cmd = []
  update = %W[git fetch --quiet --all --prune]
  cmd << update
  checkout = %W[git reset --hard origin/#{fetch(:branch)}]
  cmd << checkout
  cmd
end