mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Merge pull request #16867 from Homebrew/stop-using-full-name-as-key-in-cask-json-v3
cask: always return short cask tokens from core cask tap
This commit is contained in:
commit
58b84c3979
@ -81,12 +81,14 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
|
||||
cask_tokens = Tap.flat_map(&:cask_tokens).filter_map do |c|
|
||||
next if c.start_with?("homebrew/cask/") && !Homebrew::EnvConfig.no_install_from_api?
|
||||
|
||||
c.sub(%r{^homebrew/cask.*/}, "")
|
||||
cask_tokens = Tap.each_with_object([]) do |tap, array|
|
||||
# We can exclude the core cask tap because `CoreCaskTap#cask_tokens` returns short names by default.
|
||||
if tap.official? && !tap.core_cask_tap?
|
||||
tap.cask_tokens.each { |token| array << token.sub(%r{^homebrew/cask.*/}, "") }
|
||||
else
|
||||
tap.cask_tokens.each { |token| array << token }
|
||||
end
|
||||
cask_tokens |= Homebrew::API::Cask.all_casks.keys unless Homebrew::EnvConfig.no_install_from_api?
|
||||
end.uniq
|
||||
|
||||
results = search(cask_tokens, string_or_regex)
|
||||
results += DidYouMean::SpellChecker.new(dictionary: cask_tokens)
|
||||
|
@ -1076,6 +1076,12 @@ class AbstractCoreTap < Tap
|
||||
instance.ensure_installed!
|
||||
end
|
||||
|
||||
# @private
|
||||
sig { params(file: Pathname).returns(String) }
|
||||
def formula_file_to_name(file)
|
||||
file.basename(".rb").to_s
|
||||
end
|
||||
|
||||
# @private
|
||||
sig { override.returns(T::Boolean) }
|
||||
def should_report_analytics?
|
||||
@ -1245,12 +1251,6 @@ class CoreTap < AbstractCoreTap
|
||||
end
|
||||
end
|
||||
|
||||
# @private
|
||||
sig { params(file: Pathname).returns(String) }
|
||||
def formula_file_to_name(file)
|
||||
file.basename(".rb").to_s
|
||||
end
|
||||
|
||||
# @private
|
||||
sig { params(file: Pathname).returns(String) }
|
||||
def alias_file_to_name(file)
|
||||
|
@ -14,12 +14,14 @@ module Homebrew
|
||||
Homebrew.with_no_api_env do
|
||||
@name = tap.name
|
||||
@path = tap.path
|
||||
@cask_tokens = tap.cask_tokens
|
||||
@tap_audit_exceptions = tap.audit_exceptions
|
||||
@tap_style_exceptions = tap.style_exceptions
|
||||
@tap_pypi_formula_mappings = tap.pypi_formula_mappings
|
||||
@problems = []
|
||||
|
||||
@cask_tokens = tap.cask_tokens.map do |cask_token|
|
||||
cask_token.split("/").last
|
||||
end
|
||||
@formula_aliases = tap.aliases.map do |formula_alias|
|
||||
formula_alias.split("/").last
|
||||
end
|
||||
@ -83,7 +85,7 @@ module Homebrew
|
||||
invalid_formulae_casks = list.select do |formula_or_cask_name|
|
||||
formula_names.exclude?(formula_or_cask_name) &&
|
||||
formula_aliases.exclude?(formula_or_cask_name) &&
|
||||
cask_tokens.exclude?("#{@name}/#{formula_or_cask_name}")
|
||||
cask_tokens.exclude?(formula_or_cask_name)
|
||||
end
|
||||
|
||||
return if invalid_formulae_casks.empty?
|
||||
|
Loading…
x
Reference in New Issue
Block a user