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
commit8e944d5728d6738b9b08f34413cb0124f9b0e2da (patch)
tree27ef4004f52f186220f9c48eca359cc7268b50fa /Library
parent5c27f0ccb98e413b8b836160333c06d136c9a937 (diff)
downloadbrew-8e944d5728d6738b9b08f34413cb0124f9b0e2da.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