diff options
| author | Jack Nagel | 2012-01-12 00:57:23 -0600 |
|---|---|---|
| committer | Jack Nagel | 2012-01-12 01:16:02 -0600 |
| commit | ed2202d349d425553e872bf946af6438eb8a403f (patch) | |
| tree | a430d03000cbf6b73631437bbe72c75c946fe90c /Library | |
| parent | 29741d2dec4b5d5b753982f60cab9388a8059c38 (diff) | |
| download | homebrew-ed2202d349d425553e872bf946af6438eb8a403f.tar.bz2 | |
versions: use the actual class name when unloading
And document a bit more why this hack is present.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/versions.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/versions.rb b/Library/Homebrew/cmd/versions.rb index 696282545..5a84e9b50 100644 --- a/Library/Homebrew/cmd/versions.rb +++ b/Library/Homebrew/cmd/versions.rb @@ -62,8 +62,15 @@ class Formula mktemp do path = Pathname.new(Pathname.pwd+"#{name}.rb") path.write text_from_sha(sha) - # FIXME: shouldn't have to do this? - Object.send(:remove_const, "#{name.capitalize}") + + # Unload the class so Formula#version returns the correct value. + # Note that this means that the command will error out after it + # encounters a formula that won't import. This doesn't matter + # for most formulae, but e.g. Bash at revision aae084c9db has a + # syntax error and so `versions` isn't able to walk very far back + # through the history. + # FIXME shouldn't have to do this? + Object.send(:remove_const, "#{Formula.class_s(name)}") Formula.factory(path).version end rescue nil end |
