Class: Capistrano::Patch::Strategy::Base

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

Direct Known Subclasses

Git

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

Returns a new instance of Base.



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/capistrano/patch/strategy/base.rb', line 8

def initialize(*)
  super

  if ENV['PATCH']
    ENV['FROM'], ENV['TO'] = File.basename(ENV['PATCH'], '.patch').split('-', 2)
  end

  ENV['FROM'] or abort "Please specify FROM revision environment variable"
  ENV['TO']   or abort "Please specify TO revision environment variable"

  @revision_from = normalize_revision(ENV['FROM'])
  @revision_to   = normalize_revision(ENV['TO'])
end

Instance Attribute Details

#revision_fromObject (readonly)

Configuration



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

def revision_from
  @revision_from
end

#revision_toObject (readonly)

Configuration



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

def revision_to
  @revision_to
end

Instance Method Details

#applyObject

Raises:

  • (NotImplementedError)


64
65
66
# File 'lib/capistrano/patch/strategy/base.rb', line 64

def apply
  raise NotImplementedError, "`apply' is not implemented by #{self.class.name}"
end

#check_applyObject

Raises:

  • (NotImplementedError)


56
57
58
# File 'lib/capistrano/patch/strategy/base.rb', line 56

def check_apply
  raise NotImplementedError, "`check_apply' is not implemented by #{self.class.name}"
end

#check_revertObject

Raises:

  • (NotImplementedError)


60
61
62
# File 'lib/capistrano/patch/strategy/base.rb', line 60

def check_revert
  raise NotImplementedError, "`check_revert' is not implemented by #{self.class.name}"
end

#createObject

Actions

Raises:

  • (NotImplementedError)


48
49
50
# File 'lib/capistrano/patch/strategy/base.rb', line 48

def create
  raise NotImplementedError, "`create' is not implemented by #{self.class.name}"
end

#deliverObject

Raises:

  • (NotImplementedError)


52
53
54
# File 'lib/capistrano/patch/strategy/base.rb', line 52

def deliver
  raise NotImplementedError, "`deliver' is not implemented by #{self.class.name}"
end

#mark_applyObject



72
73
74
# File 'lib/capistrano/patch/strategy/base.rb', line 72

def mark_apply
  mark(revision_to)
end

#mark_revertObject



76
77
78
# File 'lib/capistrano/patch/strategy/base.rb', line 76

def mark_revert
  mark(revision_from)
end

#patch_directoryObject

Raises:

  • (NotImplementedError)


32
33
34
# File 'lib/capistrano/patch/strategy/base.rb', line 32

def patch_directory
  raise NotImplementedError, "`patch_directory' is not implemented by #{self.class.name}"
end

#patch_fileObject



28
29
30
# File 'lib/capistrano/patch/strategy/base.rb', line 28

def patch_file
  @patch_file ||= "#{revision_from}-#{revision_to}.patch"
end

#patch_locationObject

Raises:

  • (NotImplementedError)


40
41
42
# File 'lib/capistrano/patch/strategy/base.rb', line 40

def patch_location
  raise NotImplementedError, "`patch_location' is not implemented by #{self.class.name}"
end

#patch_pathObject



36
37
38
# File 'lib/capistrano/patch/strategy/base.rb', line 36

def patch_path
  File.join patch_directory, patch_file
end

#revertObject

Raises:

  • (NotImplementedError)


68
69
70
# File 'lib/capistrano/patch/strategy/base.rb', line 68

def revert
  raise NotImplementedError, "`revert' is not implemented by #{self.class.name}"
end