From b40615d66ac8572c6735f3bb9d6cd3e781edf740 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Sun, 30 Jun 2013 10:26:12 -0700 Subject: Catch another name error Closes Homebrew/homebrew#20920. --- Library/Homebrew/formulary.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'Library') diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index ef59460de..fb633d661 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -28,7 +28,13 @@ class Formulary # Return the Class for this formula, `require`-ing it if # it has not been parsed before. def klass - unless Formulary.formula_class_defined? name + begin + have_klass = Formulary.formula_class_defined? name + rescue NameError + raise FormulaUnavailableError.new(name) + end + + unless have_klass puts "#{$0}: loading #{path}" if ARGV.debug? begin require path.to_s @@ -40,6 +46,7 @@ class Formulary raise FormulaUnavailableError.new(name) end end + klass = Formulary.get_formula_class(name) if (klass == Formula) || !klass.ancestors.include?(Formula) raise FormulaUnavailableError.new(name) -- cgit v1.2.3