aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2013-09-21 15:14:20 +0100
committerMike McQuaid2013-09-22 09:52:05 +0100
commit8bdf158032039986a13af005cb0d66c654219ef3 (patch)
tree2c81f223d669e32ec481c728b1575da453cf4e93 /Library
parent73705151b479163f5fa1abf407135410a8f05495 (diff)
downloadhomebrew-8bdf158032039986a13af005cb0d66c654219ef3.tar.bz2
versions: split version_for_sha and use yield.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/versions.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/versions.rb b/Library/Homebrew/cmd/versions.rb
index 164222092..1dbe1a64a 100644
--- a/Library/Homebrew/cmd/versions.rb
+++ b/Library/Homebrew/cmd/versions.rb
@@ -81,6 +81,10 @@ class Formula
ArgumentError, FormulaSpecificationError]
def version_for_sha sha
+ formula_for_sha(sha) {|f| f.version }
+ end
+
+ def formula_for_sha sha, &block
mktemp do
path = Pathname.new(Pathname.pwd+"#{name}.rb")
path.write text_from_sha(sha)
@@ -88,7 +92,7 @@ class Formula
# Unload the class so Formula#version returns the correct value
begin
Formulary.unload_formula name
- nostdout { Formula.factory(path.to_s).version }
+ nostdout { yield Formula.factory(path.to_s) }
rescue *IGNORED_EXCEPTIONS => e
# We rescue these so that we can skip bad versions and
# continue walking the history