aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/formula_pin.rb
diff options
context:
space:
mode:
authorJack Nagel2014-06-21 18:20:51 -0500
committerJack Nagel2014-06-21 18:32:53 -0500
commita9a81acdc215bb6b8b7187cec08561dbb288367b (patch)
tree138a91891e9417f0564cb126a00507005bcfba03 /Library/Homebrew/formula_pin.rb
parent3ebbbd5375375e50c6e037b92b929aa053fd7e89 (diff)
downloadhomebrew-a9a81acdc215bb6b8b7187cec08561dbb288367b.tar.bz2
Simplify picking pinned version
Diffstat (limited to 'Library/Homebrew/formula_pin.rb')
-rw-r--r--Library/Homebrew/formula_pin.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/Library/Homebrew/formula_pin.rb b/Library/Homebrew/formula_pin.rb
index d7a8d8637..969e8a4d2 100644
--- a/Library/Homebrew/formula_pin.rb
+++ b/Library/Homebrew/formula_pin.rb
@@ -1,3 +1,5 @@
+require "keg"
+
class FormulaPin
PINDIR = Pathname.new("#{HOMEBREW_LIBRARY}/PinnedKegs")
@@ -16,9 +18,7 @@ class FormulaPin
end
def pin
- versions = @f.rack.children.map { |item| item.basename.to_s }
- version = versions.map { |item| Version.new(item) }.sort[0].to_s
- pin_at(version)
+ pin_at(@f.rack.subdirs.map { |d| Keg.new(d).version }.first)
end
def unpin
@@ -30,6 +30,6 @@ class FormulaPin
end
def pinnable?
- @f.rack.exist? && @f.rack.children.length > 0
+ @f.rack.exist? && @f.rack.subdirs.length > 0
end
end