diff --git a/.gitignore b/.gitignore index 7e87d15850..b89793014d 100644 --- a/.gitignore +++ b/.gitignore @@ -70,7 +70,6 @@ !**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/hash/keys.rb !**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/object/deep_dup.rb !**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/object/duplicable.rb -!**/vendor/bundle/ruby/*/gems/activesupport-*/lib/active_support/core_ext/string/exclude.rb # Ignore partially included gems where we don't need all files **/vendor/gems/mechanize-*/.* diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb index 17ce9fac20..af8931b6fe 100644 --- a/Library/Homebrew/download_strategy.rb +++ b/Library/Homebrew/download_strategy.rb @@ -360,7 +360,7 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy end if search_query && (uri_query = uri.query.presence) - components[:query] = URI.decode_www_form(uri_query).map { _1.fetch(1) } + components[:query] = URI.decode_www_form(uri_query).map { _2 } end else components[:path] = [url] diff --git a/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/string/exclude.rb b/Library/Homebrew/extend/string.rb similarity index 71% rename from Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/string/exclude.rb rename to Library/Homebrew/extend/string.rb index 8e462689f1..6beadc7272 100644 --- a/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/activesupport-6.1.7.6/lib/active_support/core_ext/string/exclude.rb +++ b/Library/Homebrew/extend/string.rb @@ -1,3 +1,4 @@ +# typed: strict # frozen_string_literal: true class String @@ -7,7 +8,6 @@ class String # "hello".exclude? "lo" # => false # "hello".exclude? "ol" # => true # "hello".exclude? ?h # => false - def exclude?(string) - !include?(string) - end + sig { params(string: String).returns(T::Boolean) } + def exclude?(string) = !include?(string) end diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index 960817893f..830c263174 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -10,13 +10,10 @@ require "json/add/exception" require "forwardable" require "set" -# Only require "core_ext" here to ensure we're only requiring the minimum of -# what we need. require "active_support/core_ext/enumerable" require "active_support/core_ext/file/atomic" require "active_support/core_ext/hash/deep_merge" require "active_support/core_ext/hash/keys" -require "active_support/core_ext/string/exclude" HOMEBREW_API_DEFAULT_DOMAIN = ENV.fetch("HOMEBREW_API_DEFAULT_DOMAIN").freeze HOMEBREW_BOTTLE_DEFAULT_DOMAIN = ENV.fetch("HOMEBREW_BOTTLE_DEFAULT_DOMAIN").freeze @@ -71,6 +68,7 @@ HOMEBREW_BOTTLES_EXTNAME_REGEX = /\.([a-z0-9_]+)\.bottle\.(?:(\d+)\.)?tar\.gz$/ require "extend/array" require "extend/blank" +require "extend/string" require "env_config" require "macos_version" require "os" diff --git a/Library/Homebrew/livecheck/strategy/gnu.rb b/Library/Homebrew/livecheck/strategy/gnu.rb index 90c39af566..40b485274c 100644 --- a/Library/Homebrew/livecheck/strategy/gnu.rb +++ b/Library/Homebrew/livecheck/strategy/gnu.rb @@ -1,4 +1,4 @@ -# typed: true +# typed: strict # frozen_string_literal: true module Homebrew @@ -32,11 +32,11 @@ module Homebrew NICE_NAME = "GNU" # The `Regexp` used to determine if the strategy applies to the URL. - URL_MATCH_REGEX = %r{ + URL_MATCH_REGEX = T.let(%r{ ^https?:// (?:(?:[^/]+?\.)*gnu\.org/(?:gnu|software)/(?[^/]+)/ |(?[^/]+)\.gnu\.org/?$) - }ix + }ix.freeze, Regexp) # Whether the strategy can be applied to the provided URL. #