Skip to content

Commit

Permalink
Merge pull request #57 from SMillerDev/fix/font/ignore_first_dir
Browse files Browse the repository at this point in the history
fix: replace first directory with wildcard
  • Loading branch information
tani committed Jul 14, 2024
2 parents 2270ade + 813835c commit f0f2378
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions cmd/generate-linux-fonts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,15 @@ def get_font_paths(cask)
next unless artifact.key?("font")

artifact["font"].each do |font|
paths << "#{path_prefix}./**/#{font}"
font = font.gsub(/\[|\]/) { |_s| "?" }
font_dir = File.dirname(font)
if font_dir == "."
paths << "#{path_prefix}./**/#{font}"
else
first_dir = font_dir.split("/")[0]
odebug first_dir, font, font.gsub("#{first_dir}/", "**/")
paths << "#{path_prefix}./#{font.gsub("#{first_dir}/", "**/")}"
end
end
end

Expand Down Expand Up @@ -183,7 +191,7 @@ class #{classname} < Formula

formula += <<-EOS
deprecate! "#{cask["deprecation_date"]}", because: #{reason}
deprecate! "#{cask["deprecation_date"]}", because: :#{cask["deprecation_reason"]}
EOS
end

Expand All @@ -192,8 +200,8 @@ class #{classname} < Formula
def install
EOS

paths.each do |path|
formula += <<-EOS
paths.sort.each do |path|
formula += <<-EOS
(share/"fonts").install Dir.glob("#{path}")[0]
EOS
end
Expand Down

0 comments on commit f0f2378

Please sign in to comment.