From 48e5201c6655ca1b6bc307db6874f86a36b76b1a Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Fri, 25 Nov 2022 14:12:47 +0100 Subject: [PATCH] casks: Modernize * Remove appcast * Process fonts in alphabetical order * Skip fonts where no checksum can be determined * Add livecheck * Add description * Fail generation on any error in the script [notes] * The code to work without checksum (:no_check) did not work anyhow Signed-off-by: Fini Jastrow --- bin/scripts/generate-casks.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/bin/scripts/generate-casks.sh b/bin/scripts/generate-casks.sh index 4ad3e4dd8..1df32852d 100755 --- a/bin/scripts/generate-casks.sh +++ b/bin/scripts/generate-casks.sh @@ -6,14 +6,12 @@ # only adds non-Windows versions of the fonts #set -x +set -e version="2.3.0-RC" patched_parent_dir="../../patched-fonts/" homepage="https://github.com/ryanoasis/nerd-fonts" downloadarchive="https://github.com/ryanoasis/nerd-fonts/releases/download/v#{version}/" -sha256sum=":no_check" -appcast="https://github.com/ryanoasis/nerd-fonts/releases.atom" -appcastcheckpoint=$(curl --compressed --location --user-agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36' "https://github.com/ryanoasis/nerd-fonts/releases.atom" | sed 's|[^<]*||g' | shasum --algorithm 256 | head -c 64) LINE_PREFIX="# [Nerd Fonts] " cd $patched_parent_dir || { @@ -36,8 +34,6 @@ function write_header { printf " version \"%s\"\\n" "$version" printf " sha256 \"%s\"\\n\\n" "$sha256sum" printf " url \"%s%s.zip\"\\n" "$downloadarchive" "$basename" - printf " appcast '%s',\\n" "$appcast" - printf " checkpoint: '%s'\\n" "$appcastcheckpoint" } >> "$outputfile" } @@ -56,8 +52,13 @@ function write_body { familyname=$(fc-query --format='%{family}' "${fonts[$i]}") { printf " name \"%s (%s)\"\\n" "$familyname" "$basename" + printf " desc \"Developer targeted fonts with a high number of glyphs\"\\n" printf " homepage \"%s\"" "$homepage" printf "\\n\\n" + printf " livecheck do\\n" + printf " url :url\\n" + printf " strategy :github_latest\\n" + printf " end\\n\\n" } >> "$outputfile" fi @@ -84,11 +85,15 @@ fi #find ./Hack -maxdepth 0 -type d | # uncomment to test 1 font #find ./ProFont -maxdepth 2 -type d | # uncomment to test 1 font -find . -maxdepth 1 -mindepth 1 -type d -iregex "\./$pattern" | +find . -maxdepth 1 -mindepth 1 -type d -iregex "\./$pattern" | sort | while read -r filename; do dirname=$(dirname "$filename") basename=$(basename "$filename") + if [ ! -f "../archives/${basename}.zip" ]; then + echo "${LINE_PREFIX} No archive for: ${basename}, skipping..." + continue + fi sha256sum=$(sha256sum "../archives/${basename}.zip" | head -c 64) searchdir=$filename