Class: FormulaPin
- Inherits:
-
Object
- Object
- FormulaPin
- Defined in:
- Library/Homebrew/formula_pin.rb
Instance Method Summary collapse
-
#initialize(f) ⇒ FormulaPin
constructor
A new instance of FormulaPin.
- #path ⇒ Object
- #pin ⇒ Object
- #pin_at(version) ⇒ Object
- #pinnable? ⇒ Boolean
- #pinned? ⇒ Boolean
- #pinned_version ⇒ Object
- #unpin ⇒ Object
Constructor Details
#initialize(f) ⇒ FormulaPin
4 5 6 |
# File 'Library/Homebrew/formula_pin.rb', line 4 def initialize(f) @f = f end |
Instance Method Details
#path ⇒ Object
8 9 10 |
# File 'Library/Homebrew/formula_pin.rb', line 8 def path HOMEBREW_PINNED_KEGS/@f.name end |
#pin ⇒ Object
18 19 20 |
# File 'Library/Homebrew/formula_pin.rb', line 18 def pin pin_at(@f.installed_kegs.map(&:version).max) end |
#pin_at(version) ⇒ Object
12 13 14 15 16 |
# File 'Library/Homebrew/formula_pin.rb', line 12 def pin_at(version) HOMEBREW_PINNED_KEGS.mkpath version_path = @f.rack/version path.make_relative_symlink(version_path) unless pinned? || !version_path.exist? end |
#pinnable? ⇒ Boolean
31 32 33 |
# File 'Library/Homebrew/formula_pin.rb', line 31 def pinnable? !@f.installed_prefixes.empty? end |
#pinned? ⇒ Boolean
27 28 29 |
# File 'Library/Homebrew/formula_pin.rb', line 27 def pinned? path.symlink? end |
#pinned_version ⇒ Object
35 36 37 |
# File 'Library/Homebrew/formula_pin.rb', line 35 def pinned_version Keg.new(path.resolved_path).version if pinned? end |
#unpin ⇒ Object
22 23 24 25 |
# File 'Library/Homebrew/formula_pin.rb', line 22 def unpin path.unlink if pinned? HOMEBREW_PINNED_KEGS.rmdir_if_possible end |