Spec-Zone.ru › Homebrew

Class: EmbeddedPatch Abstract Private

Inherits:
Object
  • Object
  • EmbeddedPatch
show all
Extended by:
T::Helpers
Includes:
Utils::Output::Mixin
Defined in:
embedded_patch.rb

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.

This class is abstract.

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

DATAPatch, LocalPatch, StringPatch

Instance Attribute Summary collapse

  • #directory ⇒ String, ... private
  • #owner ⇒ Resource::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

#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_upgradable, #pretty_warning

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.

Parameters:

  • strip (String, Symbol)


24
25
26
27
28
# File 'embedded_patch.rb', line 24

def initialize(strip)
  @strip = strip
  @owner = T.let(nil, T.nilable(Resource::Owner))
  @directory = T.let(nil, T.nilable(T.any(String, Pathname)))
end

Instance Attribute Details

#directory ⇒ 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.

Returns:

  • (String, Pathname, nil)


21
22
23
# File 'embedded_patch.rb', line 21

def directory
  @directory
end

#owner=(value) ⇒ Resource::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.

Returns:

  • (Resource::Owner, nil)


15
16
17
# File 'embedded_patch.rb', line 15

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.

Returns:

  • (String, Symbol)


18
19
20
# File 'embedded_patch.rb', line 18

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.



39
40
41
42
43
44
45
46
47
48
49
# File 'embedded_patch.rb', line 39

def apply
  data = contents.gsub("@@HOMEBREW_PREFIX@@", HOMEBREW_PREFIX)
  args = %W[-g0-f-#{strip}]
  dir = Pathname.pwd
  if (subdirectory = directory.presence)
    dir /= subdirectory
  end
  dir.cd do
    Utils.safe_popen_write("patch", *args) { |p| p.write(data) }
  end
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.

This method is abstract.

Returns:

  • (String)


36
# File 'embedded_patch.rb', line 36

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.

Returns:

  • (Boolean)


31
32
33
# File 'embedded_patch.rb', line 31

def external?
  false
end

© 2009–present Homebrew contributors
Licensed under the BSD 2-Clause License.
https://docs.brew.sh/rubydoc/EmbeddedPatch.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API