Class: EmbeddedPatch Abstract Private
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
It cannot be directly instantiated. Subclasses must implement the abstract methods below.
An abstract class representing a patch embedded into a formula.
Direct Known Subclasses
Instance Attribute Summary collapse
- #owner ⇒ Owner? writeonly private
- #strip ⇒ String, Symbol readonly private
Instance Method Summary collapse
- #apply ⇒ void private
- #contents ⇒ String abstract private
- #external? ⇒ Boolean private
- #initialize(strip) ⇒ void constructor private
Methods included from Utils::Output::Mixin
#odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled
Constructor Details
#initialize(strip) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
52 53 54 55 |
# File 'patch.rb', line 52 def initialize(strip) @strip = T.let(strip, T.any(String, Symbol)) @owner = T.let(nil, T.nilable(Owner)) end |
Instance Attribute Details
#owner=(value) ⇒ Owner? (writeonly)
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
46 47 48 |
# File 'patch.rb', line 46 def owner=(value) @owner = value end |
#strip ⇒ String, Symbol (readonly)
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
49 50 51 |
# File 'patch.rb', line 49 def strip @strip end |
Instance Method Details
#apply ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
66 67 68 69 70 71 72 73 74 |
# File 'patch.rb', line 66 def apply data = contents.gsub("@@HOMEBREW_PREFIX@@", HOMEBREW_PREFIX) if data.gsub!("HOMEBREW_PREFIX", HOMEBREW_PREFIX) odeprecated "patch with HOMEBREW_PREFIX placeholder", "patch with @@HOMEBREW_PREFIX@@ placeholder" end args = %W[-g 0 -f -#{strip}] Utils.safe_popen_write("patch", *args) { |p| p.write(data) } end |
#contents ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
63 |
# File 'patch.rb', line 63 def contents; end |
#external? ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
58 59 60 |
# File 'patch.rb', line 58 def external? false end |