mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Add ActiveSupport String#exclude? to extend/
This commit is contained in:
parent
b60d951d48
commit
2e21efff46
1
.gitignore
vendored
1
.gitignore
vendored
@ -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/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/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/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
|
# Ignore partially included gems where we don't need all files
|
||||||
**/vendor/gems/mechanize-*/.*
|
**/vendor/gems/mechanize-*/.*
|
||||||
|
@ -360,7 +360,7 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
|
|||||||
end
|
end
|
||||||
|
|
||||||
if search_query && (uri_query = uri.query.presence)
|
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
|
end
|
||||||
else
|
else
|
||||||
components[:path] = [url]
|
components[:path] = [url]
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class String
|
class String
|
||||||
@ -7,7 +8,6 @@ class String
|
|||||||
# "hello".exclude? "lo" # => false
|
# "hello".exclude? "lo" # => false
|
||||||
# "hello".exclude? "ol" # => true
|
# "hello".exclude? "ol" # => true
|
||||||
# "hello".exclude? ?h # => false
|
# "hello".exclude? ?h # => false
|
||||||
def exclude?(string)
|
sig { params(string: String).returns(T::Boolean) }
|
||||||
!include?(string)
|
def exclude?(string) = !include?(string)
|
||||||
end
|
|
||||||
end
|
end
|
@ -10,13 +10,10 @@ require "json/add/exception"
|
|||||||
require "forwardable"
|
require "forwardable"
|
||||||
require "set"
|
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/enumerable"
|
||||||
require "active_support/core_ext/file/atomic"
|
require "active_support/core_ext/file/atomic"
|
||||||
require "active_support/core_ext/hash/deep_merge"
|
require "active_support/core_ext/hash/deep_merge"
|
||||||
require "active_support/core_ext/hash/keys"
|
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_API_DEFAULT_DOMAIN = ENV.fetch("HOMEBREW_API_DEFAULT_DOMAIN").freeze
|
||||||
HOMEBREW_BOTTLE_DEFAULT_DOMAIN = ENV.fetch("HOMEBREW_BOTTLE_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/array"
|
||||||
require "extend/blank"
|
require "extend/blank"
|
||||||
|
require "extend/string"
|
||||||
require "env_config"
|
require "env_config"
|
||||||
require "macos_version"
|
require "macos_version"
|
||||||
require "os"
|
require "os"
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# typed: true
|
# typed: strict
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
@ -32,11 +32,11 @@ module Homebrew
|
|||||||
NICE_NAME = "GNU"
|
NICE_NAME = "GNU"
|
||||||
|
|
||||||
# The `Regexp` used to determine if the strategy applies to the URL.
|
# The `Regexp` used to determine if the strategy applies to the URL.
|
||||||
URL_MATCH_REGEX = %r{
|
URL_MATCH_REGEX = T.let(%r{
|
||||||
^https?://
|
^https?://
|
||||||
(?:(?:[^/]+?\.)*gnu\.org/(?:gnu|software)/(?<project_name>[^/]+)/
|
(?:(?:[^/]+?\.)*gnu\.org/(?:gnu|software)/(?<project_name>[^/]+)/
|
||||||
|(?<project_name>[^/]+)\.gnu\.org/?$)
|
|(?<project_name>[^/]+)\.gnu\.org/?$)
|
||||||
}ix
|
}ix.freeze, Regexp)
|
||||||
|
|
||||||
# Whether the strategy can be applied to the provided URL.
|
# Whether the strategy can be applied to the provided URL.
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user