From db4099d9776450973c4b94143316549272f663bd Mon Sep 17 00:00:00 2001 From: Bevan Kay Date: Thu, 16 May 2024 11:29:58 +1000 Subject: [PATCH 1/2] cask/audit: fix sharding for `font-*` casks --- Library/Homebrew/cask/audit.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Library/Homebrew/cask/audit.rb b/Library/Homebrew/cask/audit.rb index 4667f36c03..a8a34133c5 100644 --- a/Library/Homebrew/cask/audit.rb +++ b/Library/Homebrew/cask/audit.rb @@ -817,11 +817,7 @@ module Cask def audit_cask_path return unless cask.tap.core_cask_tap? - expected_path = if cask.artifacts.any?(Artifact::Font) - cask.tap.new_cask_font_path(cask.token) - else - cask.tap.new_cask_path(cask.token) - end + expected_path = cask.tap.new_cask_path(cask.token) return if cask.sourcefile_path.to_s.end_with?(expected_path) From 1b286befedc750f905a294e0018ded16e28c1600 Mon Sep 17 00:00:00 2001 From: Bevan Kay Date: Thu, 16 May 2024 11:29:59 +1000 Subject: [PATCH 2/2] tap: fix sharding for `font-*` casks --- Library/Homebrew/tap.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index 724b90b83b..6a0dfd7ec5 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -1397,14 +1397,11 @@ class CoreCaskTap < AbstractCoreTap sig { params(token: String).returns(Pathname) } def new_cask_path(token) - cask_subdir = token[0].to_s - cask_dir/cask_subdir/"#{token.downcase}.rb" - end - - sig { params(token: String).returns(Pathname) } - 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_subdir = if token.start_with?("font-") + "font/font-#{token.delete_prefix("font-")[0]}" + else + token[0].to_s + end cask_dir/cask_subdir/"#{token.downcase}.rb" end