diff options
| author | Jack Nagel | 2014-12-29 14:53:22 -0500 | 
|---|---|---|
| committer | Jack Nagel | 2014-12-29 14:59:18 -0500 | 
| commit | 4d2787cae16c06b0154348085c7c7a31e640ce50 (patch) | |
| tree | 77b05db356281d1ce8a47c1bbf968dacf6c40b3b | |
| parent | 20c08894bdddd2d62fea124ec5658313fccbd466 (diff) | |
| download | homebrew-4d2787cae16c06b0154348085c7c7a31e640ce50.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. | 
