Class: FormulaPin 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.
Helper functions for pinning a formula.
Instance Method Summary collapse
-
#initialize(formula) ⇒ FormulaPin
constructor
private
A new instance of FormulaPin.
-
#path ⇒ Object
private
-
#pin ⇒ Object
private
-
#pin_at(version) ⇒ Object
private
-
#pinnable? ⇒ Boolean
private
-
#pinned? ⇒ Boolean
private
-
#pinned_version ⇒ Object
private
-
#unpin ⇒ Object
private
Constructor Details
#initialize(formula) ⇒ FormulaPin
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 a new instance of FormulaPin.
10 11 12 |
# File 'formula_pin.rb', line 10 def initialize(formula) @formula = formula end |
Instance Method Details
#path ⇒ Object
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.
14 15 16 |
# File 'formula_pin.rb', line 14 def path HOMEBREW_PINNED_KEGS/@formula.name end |
#pin ⇒ Object
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.
24 25 26 |
# File 'formula_pin.rb', line 24 def pin pin_at(@formula.installed_kegs.map(&:version).max) end |
#pin_at(version) ⇒ Object
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.
18 19 20 21 22 |
# File 'formula_pin.rb', line 18 def pin_at(version) HOMEBREW_PINNED_KEGS.mkpath version_path = @formula.rack/version path.make_relative_symlink(version_path) if !pinned? && version_path.exist? end |
#pinnable? ⇒ 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.
37 38 39 |
# File 'formula_pin.rb', line 37 def pinnable? !@formula.installed_prefixes.empty? end |
#pinned? ⇒ 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.
33 34 35 |
# File 'formula_pin.rb', line 33 def pinned? path.symlink? end |
#pinned_version ⇒ Object
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.
41 42 43 |
# File 'formula_pin.rb', line 41 def pinned_version Keg.new(path.resolved_path).version if pinned? end |
#unpin ⇒ Object
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.
28 29 30 31 |
# File 'formula_pin.rb', line 28 def unpin path.unlink if pinned? HOMEBREW_PINNED_KEGS.rmdir_if_possible end |