Merge pull request #17311 from bevanjkay/cask-sharding-fix

cask/audit: fix sharding for font-* casks
This commit is contained in:
Mike McQuaid 2024-05-16 11:58:50 +09:00 committed by GitHub
commit 1fac68348a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 13 deletions

View File

@ -817,11 +817,7 @@ module Cask
def audit_cask_path def audit_cask_path
return unless cask.tap.core_cask_tap? return unless cask.tap.core_cask_tap?
expected_path = if cask.artifacts.any?(Artifact::Font) expected_path = cask.tap.new_cask_path(cask.token)
cask.tap.new_cask_font_path(cask.token)
else
cask.tap.new_cask_path(cask.token)
end
return if cask.sourcefile_path.to_s.end_with?(expected_path) return if cask.sourcefile_path.to_s.end_with?(expected_path)

View File

@ -1397,14 +1397,11 @@ class CoreCaskTap < AbstractCoreTap
sig { params(token: String).returns(Pathname) } sig { params(token: String).returns(Pathname) }
def new_cask_path(token) def new_cask_path(token)
cask_subdir = token[0].to_s cask_subdir = if token.start_with?("font-")
cask_dir/cask_subdir/"#{token.downcase}.rb" "font/font-#{token.delete_prefix("font-")[0]}"
end else
token[0].to_s
sig { params(token: String).returns(Pathname) } end
def new_cask_font_path(token)
font_first_letter = T.must(token.split("font-").second)[0].to_s
cask_subdir = "font/font-#{font_first_letter}"
cask_dir/cask_subdir/"#{token.downcase}.rb" cask_dir/cask_subdir/"#{token.downcase}.rb"
end end