From bc8845fc96f399ab44fcff3afca330c89b629ab2 Mon Sep 17 00:00:00 2001 From: Matt Troutman Date: Mon, 19 May 2025 12:10:53 -0500 Subject: [PATCH] Refactor Homebrew formula generator to correctly format class names and file paths for font installation. Update glob patterns to remove unnecessary font_name variable and ensure proper directory structure for font files. --- .fontfoldercleanup/create_homebrew_formula.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/.fontfoldercleanup/create_homebrew_formula.py b/.fontfoldercleanup/create_homebrew_formula.py index 9557cac..4a471db 100755 --- a/.fontfoldercleanup/create_homebrew_formula.py +++ b/.fontfoldercleanup/create_homebrew_formula.py @@ -16,10 +16,12 @@ class HomebrewFormulaGenerator: # This file was generated by the font folder cleanup script # Do not edit this file directly -class {formula_name.capitalize()} < Formula +class Font{formula_name.capitalize()} < Formula desc "Font: {formula_name}" homepage "http://clancy.genet-godzilla.ts.net:3002/Fonts/homebrew-fonts" + url "http://clancy.genet-godzilla.ts.net:3002/Fonts/homebrew-fonts/raw/main/font_files/{font_name}" version "1.0.0" + sha256 "" # This will need to be filled in after the first build def install # Create font directories @@ -29,23 +31,23 @@ class {formula_name.capitalize()} < Formula (share/"fonts/webfonts").mkpath # Install TTF fonts - Dir.glob("{font_name}/ttf/*.ttf").each do |font| + Dir.glob("ttf/*.ttf").each do |font| system "cp", font, share/"fonts/truetype" end # Install OTF fonts - Dir.glob("{font_name}/otf/*.otf").each do |font| + Dir.glob("otf/*.otf").each do |font| system "cp", font, share/"fonts/opentype" end # Install web fonts - Dir.glob("{font_name}/web/*.{{woff,woff2,eot,svg}}").each do |font| + Dir.glob("web/*.{{woff,woff2,eot,svg}}").each do |font| system "cp", font, share/"fonts/webfonts" end # Install documentation and other files (share/"{formula_name}").mkpath - Dir.glob("{font_name}/other_files/*").each do |file| + Dir.glob("other_files/*").each do |file| system "cp", "-r", file, share/"{formula_name}" end end @@ -81,9 +83,9 @@ end formula_name = font_name.replace('font-', '') formula_content = self.generate_formula_content(font_name, formula_name) - formula_path = self.formula_dir / f"{formula_name}.rb" + formula_path = self.formula_dir / f"font-{formula_name}.rb" formula_path.write_text(formula_content) - print(f"Generated formula for {formula_name}") + print(f"Generated formula for font-{formula_name}") def main(): # Get the absolute path to the font_files directory