diff options
| author | Jack Nagel | 2012-01-26 23:02:18 -0600 |
|---|---|---|
| committer | Jack Nagel | 2012-01-26 23:02:18 -0600 |
| commit | 1be8f8c6e2467cef562e8cc62b28aeec66c4f866 (patch) | |
| tree | 4538aa9b39fbbeb84b401cd9a16b9c6eca503a50 /Library/Homebrew/cmd | |
| parent | 744bb8fbcc77dcc84a25cbc9081b7d656631a901 (diff) | |
| download | homebrew-1be8f8c6e2467cef562e8cc62b28aeec66c4f866.tar.bz2 | |
versions: silence 'aka' warning and syntax errors
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/versions.rb | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Library/Homebrew/cmd/versions.rb b/Library/Homebrew/cmd/versions.rb index 48496d99a..55703c811 100644 --- a/Library/Homebrew/cmd/versions.rb +++ b/Library/Homebrew/cmd/versions.rb @@ -63,15 +63,21 @@ class Formula path = Pathname.new(Pathname.pwd+"#{name}.rb") path.write text_from_sha(sha) - # Unload the class so Formula#version returns the correct value. + # Determine the version by loading the old class file. # 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. + + # Unload the class so Formula#version returns the correct value. # FIXME shouldn't have to do this? - Object.send(:remove_const, "#{Formula.class_s(name)}") - Formula.factory(path).version + Object.send(:remove_const, Formula.class_s(name)) + begin + nostdout { Formula.factory(path).version } + rescue SyntaxError + nil + end end rescue nil end end |
