Document Patch
.
This commit is contained in:
parent
3a04377b51
commit
b9894e2241
@ -3,6 +3,9 @@
|
|||||||
require "resource"
|
require "resource"
|
||||||
require "erb"
|
require "erb"
|
||||||
|
|
||||||
|
# Helper module for creating patches.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
module Patch
|
module Patch
|
||||||
def self.create(strip, src, &block)
|
def self.create(strip, src, &block)
|
||||||
case strip
|
case strip
|
||||||
@ -52,6 +55,9 @@ module Patch
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# An abstract class representing a patch embedded into a formula.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class EmbeddedPatch
|
class EmbeddedPatch
|
||||||
attr_writer :owner
|
attr_writer :owner
|
||||||
attr_reader :strip
|
attr_reader :strip
|
||||||
@ -77,6 +83,9 @@ class EmbeddedPatch
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# A patch at the `__END__` of a formula file.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class DATAPatch < EmbeddedPatch
|
class DATAPatch < EmbeddedPatch
|
||||||
attr_accessor :path
|
attr_accessor :path
|
||||||
|
|
||||||
@ -100,6 +109,9 @@ class DATAPatch < EmbeddedPatch
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# A string containing a patch.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class StringPatch < EmbeddedPatch
|
class StringPatch < EmbeddedPatch
|
||||||
def initialize(strip, str)
|
def initialize(strip, str)
|
||||||
super(strip)
|
super(strip)
|
||||||
@ -111,6 +123,9 @@ class StringPatch < EmbeddedPatch
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# A string containing a patch.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class ExternalPatch
|
class ExternalPatch
|
||||||
extend Forwardable
|
extend Forwardable
|
||||||
|
|
||||||
@ -170,7 +185,11 @@ class ExternalPatch
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# A legacy patch.
|
||||||
|
#
|
||||||
# Legacy patches have no checksum and are not cached.
|
# Legacy patches have no checksum and are not cached.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
class LegacyPatch < ExternalPatch
|
class LegacyPatch < ExternalPatch
|
||||||
def initialize(strip, url)
|
def initialize(strip, url)
|
||||||
odeprecated "legacy patches", "'patch do' blocks"
|
odeprecated "legacy patches", "'patch do' blocks"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user