diff options
| author | Jack Nagel | 2014-12-29 14:53:22 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-12-29 14:59:18 -0500 |
| commit | 2bf1f93721fbcd96c6f4799838eaf13596dda513 (patch) | |
| tree | 9254bcb90650fda340d86e95796147cc51f96ccc | |
| parent | 4d584d37f73e0ca107c65fefd80df64e662cfd1c (diff) | |
| download | brew-2bf1f93721fbcd96c6f4799838eaf13596dda513.tar.bz2 | |
Extract method
| -rw-r--r-- | Library/Homebrew/formulary.rb | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index f4fb6bf1b..3ee853704 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. |
