diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index f4fb6bf1b3..3ee8537041 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -59,19 +59,7 @@ class Formulary raise FormulaUnavailableError.new(name) end - unless have_klass - STDERR.puts "#{$0} (#{self.class.name}): loading #{path}" if ARGV.debug? - begin - require path - rescue NoMethodError - # This is a programming error in an existing formula, and should not - # have a "no such formula" message. - raise - rescue LoadError, NameError - raise if ARGV.debug? # let's see the REAL error - raise FormulaUnavailableError.new(name) - end - end + load_file unless have_klass klass = Formulary.get_formula_class(class_name) if klass == Formula || !(klass < Formula) @@ -79,6 +67,22 @@ class Formulary end klass end + + private + + def load_file + STDERR.puts "#{$0} (#{self.class.name}): loading #{path}" if ARGV.debug? + begin + require(path) + rescue NoMethodError + # This is a programming error in an existing formula, and should not + # have a "no such formula" message. + raise + rescue LoadError, NameError + raise if ARGV.debug? # let's see the REAL error + raise FormulaUnavailableError.new(name) + end + end end # Loads formulae from bottles.