homebrew-fonts/Formula/font-moon-walk.rb
Matt Troutman cb1918c30f
Use symlinks for font installation to ~/Library/Fonts/
Homebrew sandboxes post_install, so cp fails with EPERM.
Symlinks work around this and also ensure brew uninstall
can cleanly remove fonts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 21:32:43 -06:00

73 lines
2.1 KiB
Ruby

# typed: false
# frozen_string_literal: true
# This file was generated by the font folder cleanup script
# Do not edit this file directly
# Installs: TTF OTF
class FontMoonWalk < Formula
desc "Font: moon-walk"
homepage "http://clancy.genet-godzilla.ts.net:8085/Fonts/homebrew-fonts"
url "http://clancy.genet-godzilla.ts.net:8085/Fonts/homebrew-fonts/archive/main.tar.gz"
version "1.0.0"
def install
# Create font directories
(share/"fonts").mkpath
(share/"fonts/truetype").mkpath
(share/"fonts/opentype").mkpath
(share/"fonts/webfonts").mkpath
# Install TTF fonts
Dir.glob("font_files/font-moon-walk/ttf/*.ttf").each do |font|
system "cp", font, share/"fonts/truetype"
end
# Install OTF fonts
Dir.glob("font_files/font-moon-walk/otf/*.otf").each do |font|
system "cp", font, share/"fonts/opentype"
end
# Install web fonts
Dir.glob("font_files/font-moon-walk/web/*.{woff,woff2,eot,svg}").each do |font|
system "cp", font, share/"fonts/webfonts"
end
# Install documentation and other files
(share/"moon-walk").mkpath
Dir.glob("font_files/font-moon-walk/other_files/*").each do |file|
system "cp", "-r", file, share/"moon-walk"
end
end
def post_install
user_fonts = Pathname.new(File.expand_path("~/Library/Fonts"))
user_fonts.mkpath
Dir.glob(share/"fonts/truetype/*.ttf").each do |f|
target = user_fonts/File.basename(f)
FileUtils.rm_f(target)
FileUtils.ln_sf(f, target)
end
Dir.glob(share/"fonts/opentype/*.otf").each do |f|
target = user_fonts/File.basename(f)
FileUtils.rm_f(target)
FileUtils.ln_sf(f, target)
end
end
def caveats
<<~EOS
Fonts have been copied to ~/Library/Fonts/ and should appear in Font Book.
Web fonts and other files are available in:
#{share}/fonts/webfonts
#{share}/moon-walk
EOS
end
test do
assert (share/"fonts/truetype").glob("*.ttf").any?, "No TTF fonts installed"
assert (share/"fonts/opentype").glob("*.otf").any?, "No OTF fonts installed"
end
end