Class: Capistrano::Patch::Strategy::Git

Inherits:
Base
  • Object
show all
Defined in:
lib/capistrano/patch/strategy/git.rb

Direct Known Subclasses

GitServer

Instance Attribute Summary

Attributes inherited from Base

#revision_from, #revision_to

Instance Method Summary collapse

Methods inherited from Base

#initialize, #mark_apply, #mark_revert, #patch_file, #patch_path

Constructor Details

This class inherits a constructor from Capistrano::Patch::Strategy::Base

Instance Method Details

#applyObject



42
43
44
45
46
# File 'lib/capistrano/patch/strategy/git.rb', line 42

def apply
  command = "cd #{configuration.current_path} && "
  command << source.scm('apply', "--binary #{patch_file}")
  run(command)
end

#check_applyObject



30
31
32
33
34
# File 'lib/capistrano/patch/strategy/git.rb', line 30

def check_apply
  command = "cd #{configuration.current_path} && "
  command << source.scm('apply', "--binary --check #{patch_file}")
  run(command)
end

#check_revertObject



36
37
38
39
40
# File 'lib/capistrano/patch/strategy/git.rb', line 36

def check_revert
  command = "cd #{configuration.current_path} && "
  command << source.scm('apply', "-R --binary --check #{patch_file}")
  run(command)
end

#createObject



20
21
22
23
24
# File 'lib/capistrano/patch/strategy/git.rb', line 20

def create
  command = "env GIT_DIR=#{patch_repository} "
  command << source.local.scm('diff-tree', "--binary #{revision_from}..#{revision_to} > #{patch_path}")
  system(command)
end

#deliverObject



26
27
28
# File 'lib/capistrano/patch/strategy/git.rb', line 26

def deliver
  top.upload patch_path, "#{configuration.current_path}/#{patch_file}"
end

#patch_directoryObject



12
13
14
# File 'lib/capistrano/patch/strategy/git.rb', line 12

def patch_directory
  configuration.fetch(:patch_directory, '.')
end

#patch_locationObject



16
17
18
# File 'lib/capistrano/patch/strategy/git.rb', line 16

def patch_location
  patch_path
end

#patch_repositoryObject



8
9
10
# File 'lib/capistrano/patch/strategy/git.rb', line 8

def patch_repository
  configuration.fetch(:patch_repository, '.git')
end

#revertObject



48
49
50
51
52
# File 'lib/capistrano/patch/strategy/git.rb', line 48

def revert
  command = "cd #{configuration.current_path} && "
  command << source.scm('apply', "-R --binary #{patch_file}")
  run(command)
end