aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorJack Nagel2013-12-09 21:10:32 -0600
committerJack Nagel2013-12-09 21:13:45 -0600
commit69aae1fb8b689645dccc5abc3567418b7d91062d (patch)
tree3ca674046f46b8589a0188e33e3867e851571402 /Library/Homebrew/cmd
parentf6df3e46eaf2e6cb0288026427f918ee6ccc5f4c (diff)
downloadhomebrew-69aae1fb8b689645dccc5abc3567418b7d91062d.tar.bz2
versions: restore original constant
Before: f1 = Formula.factory('tree') f1.versions f2 = Formula.factory('tree') f1.class == f2.class # => false After: f1 = Formula.factory('tree') f1.versions f2 = Formula.factory('tree') f1.class == f2.class # => true
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/versions.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/versions.rb b/Library/Homebrew/cmd/versions.rb
index 7e556ec55..feb908340 100644
--- a/Library/Homebrew/cmd/versions.rb
+++ b/Library/Homebrew/cmd/versions.rb
@@ -108,7 +108,7 @@ class Formula
# Unload the class so Formula#version returns the correct value
begin
- Formulary.unload_formula name
+ old_const = Formulary.unload_formula name
nostdout { yield Formula.factory(path.to_s) }
rescue *IGNORED_EXCEPTIONS => e
# We rescue these so that we can skip bad versions and
@@ -116,6 +116,8 @@ class Formula
ohai "#{e} in #{name} at revision #{sha}", e.backtrace if ARGV.debug?
rescue FormulaUnavailableError
# Suppress this error
+ ensure
+ Formulary.restore_formula name, old_const
end
end
end