Skip to content

Commit

Permalink
Support font sharding in Homebrew/cask
Browse files Browse the repository at this point in the history
  • Loading branch information
krehel committed May 10, 2024
1 parent 9bf7734 commit 836d819
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)

Check warning on line 820 in Library/Homebrew/cask/audit.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cask/audit.rb#L820

Added line #L820 was not covered by tests
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"

Check warning on line 1408 in Library/Homebrew/tap.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/tap.rb#L1406-L1408

Added lines #L1406 - L1408 were not covered by tests
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 836d819

Please sign in to comment.