diff options
| author | Markus Reiter | 2017-10-07 00:31:28 +0200 | 
|---|---|---|
| committer | Markus Reiter | 2017-10-08 16:10:37 +0200 | 
| commit | 175ca909ee1a5b57aa0cae2c879920511f311b14 (patch) | |
| tree | 067464b4c08f4c16ca3439b533f06669a78c370c /Library/Homebrew/formula.rb | |
| parent | 91ab116ace7f4f97d3440190463c93be9ec6d675 (diff) | |
| download | brew-175ca909ee1a5b57aa0cae2c879920511f311b14.tar.bz2 | |
Clean up code style and remove `.rubocop_todo.yml`.
Diffstat (limited to 'Library/Homebrew/formula.rb')
| -rw-r--r-- | Library/Homebrew/formula.rb | 53 | 
1 files changed, 26 insertions, 27 deletions
| diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index d999b9c5f..61042aae7 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -1041,14 +1041,14 @@ class Formula      # keg's formula is deleted.      begin        keg = Keg.for(path) -    rescue NotAKegError, Errno::ENOENT +    rescue NotAKegError, Errno::ENOENT # rubocop:disable Lint/HandleExceptions        # file doesn't belong to any keg.      else        tab_tap = Tab.for_keg(keg).tap        return false if tab_tap.nil? # this keg doesn't below to any core/tap formula, most likely coming from a DIY install.        begin          Formulary.factory(keg.name) -      rescue FormulaUnavailableError +      rescue FormulaUnavailableError # rubocop:disable Lint/HandleExceptions          # formula for this keg is deleted, so defer to whitelist        rescue TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError          return false # this keg belongs to another formula @@ -1379,12 +1379,13 @@ class Formula    # An array of all installed {Formula}    # @private    def self.installed -    @installed ||= racks.map do |rack| +    @installed ||= racks.flat_map do |rack|        begin          Formulary.from_rack(rack)        rescue FormulaUnavailableError, TapFormulaAmbiguityError, TapFormulaWithOldnameAmbiguityError +        []        end -    end.compact.uniq(&:name) +    end.uniq(&:name)    end    def self.installed_with_alias_path(alias_path) @@ -1642,7 +1643,7 @@ class Formula          with_logging("test") do            test          end -      rescue Exception +      rescue Exception # rubocop:disable Lint/RescueException          staging.retain! if ARGV.debug?          raise        end @@ -1667,8 +1668,7 @@ class Formula    end    # @private -  def test -  end +  def test; end    # @private    def test_fixtures(file) @@ -1683,8 +1683,7 @@ class Formula    #   system "./configure", "--prefix=#{prefix}"    #   system "make", "install"    # end</pre> -  def install -  end +  def install; end    protected @@ -1932,28 +1931,28 @@ class Formula      end    end -  def self.method_added(method) -    case method -    when :brew -      raise "You cannot override Formula#brew in class #{name}" -    when :test -      define_method(:test_defined?) { true } -    when :options -      instance = allocate +  # The methods below define the formula DSL. +  class << self +    include BuildEnvironment::DSL -      specs.each do |spec| -        instance.options.each do |opt, desc| -          spec.option(opt[/^--(.+)$/, 1], desc) +    def method_added(method) +      case method +      when :brew +        raise "You cannot override Formula#brew in class #{name}" +      when :test +        define_method(:test_defined?) { true } +      when :options +        instance = allocate + +        specs.each do |spec| +          instance.options.each do |opt, desc| +            spec.option(opt[/^--(.+)$/, 1], desc) +          end          end -      end -      remove_method(:options) +        remove_method(:options) +      end      end -  end - -  # The methods below define the formula DSL. -  class << self -    include BuildEnvironment::DSL      # The reason for why this software is not linked (by default) to      # {::HOMEBREW_PREFIX}. | 
