Class: EmbeddedPatch

Inherits:
Object
  • Object
show all
Defined in:
Library/Homebrew/patch.rb

Direct Known Subclasses

DATAPatch, StringPatch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(strip) ⇒ EmbeddedPatch



55
56
57
# File 'Library/Homebrew/patch.rb', line 55

def initialize(strip)
  @strip = strip
end

Instance Attribute Details

#owner=(value) ⇒ Object (writeonly)

Sets the attribute owner



52
53
54
# File 'Library/Homebrew/patch.rb', line 52

def owner=(value)
  @owner = value
end

#stripObject (readonly)

Returns the value of attribute strip



53
54
55
# File 'Library/Homebrew/patch.rb', line 53

def strip
  @strip
end

Instance Method Details

#applyObject



65
66
67
68
69
70
# File 'Library/Homebrew/patch.rb', line 65

def apply
  data = contents.gsub("HOMEBREW_PREFIX", HOMEBREW_PREFIX)
  args = %W[-g 0 -f -#{strip}]
  Utils.popen_write("patch", *args) { |p| p.write(data) }
  raise ErrorDuringExecution.new("patch", args) unless $CHILD_STATUS.success?
end

#contentsObject



63
# File 'Library/Homebrew/patch.rb', line 63

def contents; end

#external?Boolean



59
60
61
# File 'Library/Homebrew/patch.rb', line 59

def external?
  false
end

#inspectObject



72
73
74
# File 'Library/Homebrew/patch.rb', line 72

def inspect
  "#<#{self.class.name}: #{strip.inspect}>"
end