From 9b5cb6cfb648c528cfe9587363ee930dbfd23025 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sat, 27 Apr 2013 14:44:48 -0500 Subject: Allow `brew versions` to work with underspecified formulae --- Library/Homebrew/cmd/versions.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/cmd') diff --git a/Library/Homebrew/cmd/versions.rb b/Library/Homebrew/cmd/versions.rb index 205f4467e..45968100f 100644 --- a/Library/Homebrew/cmd/versions.rb +++ b/Library/Homebrew/cmd/versions.rb @@ -77,6 +77,9 @@ class Formula rev_list.find{ |sha| version == version_for_sha(sha) } end + IGNORED_EXCEPTIONS = [SyntaxError, TypeError, NameError, + ArgumentError, FormulaSpecificationError] + def version_for_sha sha mktemp do path = Pathname.new(Pathname.pwd+"#{name}.rb") @@ -86,7 +89,7 @@ class Formula begin Object.send(:remove_const, Formula.class_s(name)) nostdout { Formula.factory(path).version } - rescue SyntaxError, TypeError, NameError, ArgumentError => e + rescue *IGNORED_EXCEPTIONS => e # We rescue these so that we can skip bad versions and # continue walking the history ohai "#{e} in #{name} at revision #{sha}", e.backtrace if ARGV.debug? -- cgit v1.2.3