diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index a3d1d41c83..2d0be7bd66 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -327,7 +327,7 @@ class Formula active_spec == head end - delegate [ + delegate [ # rubocop:disable Layout/AlignHash :bottle_unneeded?, :bottle_disabled?, :bottle_disable_reason, @@ -335,7 +335,7 @@ class Formula :bottled?, :bottle_specification, :downloader, - ] => :active_spec + ] => :active_spec # The Bottle object for the currently active {SoftwareSpec}. # @private @@ -1615,10 +1615,20 @@ class Formula "bottle" => {}, "keg_only" => keg_only?, "options" => [], - "build_dependencies" => dependencies.select(&:build?).map(&:name).uniq, - "dependencies" => dependencies.reject(&:optional?).reject(&:recommended?).reject(&:build?).map(&:name).uniq, - "recommended_dependencies" => dependencies.select(&:recommended?).map(&:name).uniq, - "optional_dependencies" => dependencies.select(&:optional?).map(&:name).uniq, + "build_dependencies" => dependencies.select(&:build?) + .map(&:name) + .uniq, + "dependencies" => dependencies.reject(&:optional?) + .reject(&:recommended?) + .reject(&:build?) + .map(&:name) + .uniq, + "recommended_dependencies" => dependencies.select(&:recommended?) + .map(&:name) + .uniq, + "optional_dependencies" => dependencies.select(&:optional?) + .map(&:name) + .uniq, "requirements" => [], "conflicts_with" => conflicts.map(&:name), "caveats" => caveats, @@ -1641,9 +1651,10 @@ class Formula } bottle_info["files"] = {} bottle_spec.collector.keys.each do |os| + bottle_url = "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.rebuild).bintray}" checksum = bottle_spec.collector[os] bottle_info["files"][os] = { - "url" => "#{bottle_spec.root_url}/#{Bottle::Filename.create(self, os, bottle_spec.rebuild).bintray}", + "url" => bottle_url, checksum.hash_type.to_s => checksum.hexdigest, } end diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index e2d51f2194..041ec86b94 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -104,8 +104,10 @@ module Homebrew end end -HOMEBREW_PULL_API_REGEX = %r{https://api\.github\.com/repos/([\w-]+)/([\w-]+)?/pulls/(\d+)}.freeze -HOMEBREW_PULL_OR_COMMIT_URL_REGEX = %r[https://github\.com/([\w-]+)/([\w-]+)?/(?:pull/(\d+)|commit/[0-9a-fA-F]{4,40})].freeze +HOMEBREW_PULL_API_REGEX = + %r{https://api\.github\.com/repos/([\w-]+)/([\w-]+)?/pulls/(\d+)}.freeze +HOMEBREW_PULL_OR_COMMIT_URL_REGEX = + %r[https://github\.com/([\w-]+)/([\w-]+)?/(?:pull/(\d+)|commit/[0-9a-fA-F]{4,40})].freeze require "forwardable" require "PATH" diff --git a/Library/Homebrew/test/rubocops/homepage_cop_spec.rb b/Library/Homebrew/test/rubocops/homepage_cop_spec.rb index 58d43c5748..3758b28a19 100644 --- a/Library/Homebrew/test/rubocops/homepage_cop_spec.rb +++ b/Library/Homebrew/test/rubocops/homepage_cop_spec.rb @@ -32,11 +32,12 @@ describe RuboCop::Cop::FormulaAudit::Homepage do end RUBY - expected_offenses = [{ message: "The homepage should start with http or https (URL is ftp://example.com/foo).", - severity: :convention, - line: 2, - column: 2, - source: source }] + expected_offenses = [{ message: "The homepage should start with http or " \ + "https (URL is ftp://example.com/foo).", + severity: :convention, + line: 2, + column: 2, + source: source }] inspect_source(source)