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.
This commit is contained in:
parent
263f3c2c54
commit
bc8845fc96
1 changed files with 9 additions and 7 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue