diff options
| author | Adam Vandenberg | 2013-06-23 14:07:46 -0700 |
|---|---|---|
| committer | Adam Vandenberg | 2013-06-29 16:44:45 -0700 |
| commit | 3aca060b8f7493d26ae72c93faad037aa464c78e (patch) | |
| tree | ef629cd1949dafef81ba58c6d2fad17c5c7d460e /Library | |
| parent | af4368b4112b11f804b342f77e1e3db4c7d609be (diff) | |
| download | homebrew-3aca060b8f7493d26ae72c93faad037aa464c78e.tar.bz2 | |
Add 'unload'
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/versions.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/formulary.rb | 4 |
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 |
