Class: Vanagon::Patch

Inherits:
Object
  • Object
show all
Includes:
HashableAttributes
Defined in:
lib/vanagon/patch.rb,
lib/vanagon/extensions/hashable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashableAttributes

#to_hash, #to_json

Constructor Details

#initialize(path, strip, fuzz, after, destination) ⇒ Patch

Returns a new instance of Patch.

Raises:



25
26
27
28
29
30
31
32
# File 'lib/vanagon/patch.rb', line 25

def initialize(path, strip, fuzz, after, destination)
  raise Vanagon::Error, "We can only apply patches after the source is unpacked or after installation" unless ['unpack', 'install'].include?(after)
  @path = path
  @strip = strip
  @fuzz = fuzz
  @after = after
  @destination = destination
end

Instance Attribute Details

#afterObject (readonly)

Returns the value of attribute after.



19
20
21
# File 'lib/vanagon/patch.rb', line 19

def after
  @after
end

#destinationObject (readonly)

Returns the value of attribute destination.



23
24
25
# File 'lib/vanagon/patch.rb', line 23

def destination
  @destination
end

#fuzzObject (readonly)

Returns the value of attribute fuzz.



15
16
17
# File 'lib/vanagon/patch.rb', line 15

def fuzz
  @fuzz
end

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/vanagon/patch.rb', line 7

def path
  @path
end

#stripObject (readonly)

Returns the value of attribute strip.



11
12
13
# File 'lib/vanagon/patch.rb', line 11

def strip
  @strip
end

Instance Method Details

#cmd(platform) ⇒ Object



34
35
36
# File 'lib/vanagon/patch.rb', line 34

def cmd(platform)
  "#{platform.patch} --strip=#{@strip} --fuzz=#{@fuzz} --ignore-whitespace < $(workdir)/patches/#{File.basename(@path)}"
end