Simplify picking pinned version
This commit is contained in:
parent
4e817eaa6c
commit
d9e73c9d43
@ -1,3 +1,5 @@
|
|||||||
|
require "keg"
|
||||||
|
|
||||||
class FormulaPin
|
class FormulaPin
|
||||||
PINDIR = Pathname.new("#{HOMEBREW_LIBRARY}/PinnedKegs")
|
PINDIR = Pathname.new("#{HOMEBREW_LIBRARY}/PinnedKegs")
|
||||||
|
|
||||||
@ -16,9 +18,7 @@ class FormulaPin
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pin
|
def pin
|
||||||
versions = @f.rack.children.map { |item| item.basename.to_s }
|
pin_at(@f.rack.subdirs.map { |d| Keg.new(d).version }.first)
|
||||||
version = versions.map { |item| Version.new(item) }.sort[0].to_s
|
|
||||||
pin_at(version)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def unpin
|
def unpin
|
||||||
@ -30,6 +30,6 @@ class FormulaPin
|
|||||||
end
|
end
|
||||||
|
|
||||||
def pinnable?
|
def pinnable?
|
||||||
@f.rack.exist? && @f.rack.children.length > 0
|
@f.rack.exist? && @f.rack.subdirs.length > 0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user