Skip to content

Commit

Permalink
Merge pull request #17265 from krehel/cask-font-fixes
Browse files Browse the repository at this point in the history
Support font sharding in Homebrew/cask
  • Loading branch information
MikeMcQuaid authored May 10, 2024
2 parents c4b7621 + 836d819 commit d194ed1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Library/Homebrew/cask/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,11 @@ def audit_livecheck_https_availability
def audit_cask_path
return unless cask.tap.core_cask_tap?

expected_path = cask.tap.new_cask_path(cask.token)
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

return if cask.sourcefile_path.to_s.end_with?(expected_path)

Expand Down
7 changes: 7 additions & 0 deletions Library/Homebrew/tap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,13 @@ def new_cask_path(token)
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 = "fonts/font-#{font_first_letter}"
cask_dir/cask_subdir/"#{token.downcase}.rb"
end

sig { override.returns(T::Array[Pathname]) }
def cask_files
return super if Homebrew::EnvConfig.no_install_from_api?
Expand Down

0 comments on commit d194ed1

Please sign in to comment.