aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2013-06-23 14:07:46 -0700
committerAdam Vandenberg2013-06-29 16:44:45 -0700
commit3aca060b8f7493d26ae72c93faad037aa464c78e (patch)
treeef629cd1949dafef81ba58c6d2fad17c5c7d460e /Library
parentaf4368b4112b11f804b342f77e1e3db4c7d609be (diff)
downloadhomebrew-3aca060b8f7493d26ae72c93faad037aa464c78e.tar.bz2
Add 'unload'
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/versions.rb2
-rw-r--r--Library/Homebrew/formulary.rb4
2 files changed, 5 insertions, 1 deletions
diff --git a/Library/Homebrew/cmd/versions.rb b/Library/Homebrew/cmd/versions.rb
index 45968100f..778e92ac8 100644
--- a/Library/Homebrew/cmd/versions.rb
+++ b/Library/Homebrew/cmd/versions.rb
@@ -87,7 +87,7 @@ class Formula
# Unload the class so Formula#version returns the correct value
begin
- Object.send(:remove_const, Formula.class_s(name))
+ Formulary.unload_formula name
nostdout { Formula.factory(path).version }
rescue *IGNORED_EXCEPTIONS => e
# We rescue these so that we can skip bad versions and
diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb
index 16e766fdd..ef59460de 100644
--- a/Library/Homebrew/formulary.rb
+++ b/Library/Homebrew/formulary.rb
@@ -1,6 +1,10 @@
# The Formulary is responsible for creating instances of Formula.
class Formulary
+ def self.unload_formula formula_name
+ Object.send(:remove_const, Formula.class_s(formula_name))
+ end
+
def self.formula_class_defined? formula_name
Object.const_defined?(Formula.class_s(formula_name))
end