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
|
||||||
end
|
end
|
||||||
|
|
||||||
cask_tokens = Tap.flat_map(&:cask_tokens).filter_map do |c|
|
cask_tokens = Tap.each_with_object([]) do |tap, array|
|
||||||
next if c.start_with?("homebrew/cask/") && !Homebrew::EnvConfig.no_install_from_api?
|
# We can exclude the core cask tap because `CoreCaskTap#cask_tokens` returns short names by default.
|
||||||
|
if tap.official? && !tap.core_cask_tap?
|
||||||
c.sub(%r{^homebrew/cask.*/}, "")
|
tap.cask_tokens.each { |token| array << token.sub(%r{^homebrew/cask.*/}, "") }
|
||||||
end
|
else
|
||||||
cask_tokens |= Homebrew::API::Cask.all_casks.keys unless Homebrew::EnvConfig.no_install_from_api?
|
tap.cask_tokens.each { |token| array << token }
|
||||||
|
end
|
||||||
|
end.uniq
|
||||||
|
|
||||||
results = search(cask_tokens, string_or_regex)
|
results = search(cask_tokens, string_or_regex)
|
||||||
results += DidYouMean::SpellChecker.new(dictionary: cask_tokens)
|
results += DidYouMean::SpellChecker.new(dictionary: cask_tokens)
|
||||||
|
@ -1076,6 +1076,12 @@ class AbstractCoreTap < Tap
|
|||||||
instance.ensure_installed!
|
instance.ensure_installed!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @private
|
||||||
|
sig { params(file: Pathname).returns(String) }
|
||||||
|
def formula_file_to_name(file)
|
||||||
|
file.basename(".rb").to_s
|
||||||
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
sig { override.returns(T::Boolean) }
|
sig { override.returns(T::Boolean) }
|
||||||
def should_report_analytics?
|
def should_report_analytics?
|
||||||
@ -1245,12 +1251,6 @@ class CoreTap < AbstractCoreTap
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# @private
|
|
||||||
sig { params(file: Pathname).returns(String) }
|
|
||||||
def formula_file_to_name(file)
|
|
||||||
file.basename(".rb").to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
sig { params(file: Pathname).returns(String) }
|
sig { params(file: Pathname).returns(String) }
|
||||||
def alias_file_to_name(file)
|
def alias_file_to_name(file)
|
||||||
|
@ -14,12 +14,14 @@ module Homebrew
|
|||||||
Homebrew.with_no_api_env do
|
Homebrew.with_no_api_env do
|
||||||
@name = tap.name
|
@name = tap.name
|
||||||
@path = tap.path
|
@path = tap.path
|
||||||
@cask_tokens = tap.cask_tokens
|
|
||||||
@tap_audit_exceptions = tap.audit_exceptions
|
@tap_audit_exceptions = tap.audit_exceptions
|
||||||
@tap_style_exceptions = tap.style_exceptions
|
@tap_style_exceptions = tap.style_exceptions
|
||||||
@tap_pypi_formula_mappings = tap.pypi_formula_mappings
|
@tap_pypi_formula_mappings = tap.pypi_formula_mappings
|
||||||
@problems = []
|
@problems = []
|
||||||
|
|
||||||
|
@cask_tokens = tap.cask_tokens.map do |cask_token|
|
||||||
|
cask_token.split("/").last
|
||||||
|
end
|
||||||
@formula_aliases = tap.aliases.map do |formula_alias|
|
@formula_aliases = tap.aliases.map do |formula_alias|
|
||||||
formula_alias.split("/").last
|
formula_alias.split("/").last
|
||||||
end
|
end
|
||||||
@ -83,7 +85,7 @@ module Homebrew
|
|||||||
invalid_formulae_casks = list.select do |formula_or_cask_name|
|
invalid_formulae_casks = list.select do |formula_or_cask_name|
|
||||||
formula_names.exclude?(formula_or_cask_name) &&
|
formula_names.exclude?(formula_or_cask_name) &&
|
||||||
formula_aliases.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
|
end
|
||||||
|
|
||||||
return if invalid_formulae_casks.empty?
|
return if invalid_formulae_casks.empty?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user