From 451eed829916627e9248f1003752b43617a20ff4 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 27 Jan 2021 15:55:27 -0300 Subject: mv build-aux/ -> aux/ and scripts/ --- Makefile | 12 +- _config.yml | 3 +- aux/assert-shellcheck.sh | 6 + aux/ci/ci-build.sh | 53 +++++++ aux/ci/git-post-receive.sh | 14 ++ aux/ci/git-pre-push.sh | 19 +++ aux/guix/manifest.scm | 15 ++ aux/guix/pinned-channels.scm | 11 ++ aux/guix/with-container.sh | 4 + aux/workflow/TODOs.sh | 23 +++ aux/workflow/assert-todos.sh | 57 ++++++++ aux/workflow/preamble.md | 16 +++ aux/workflow/style.css | 38 +++++ build-aux/apply-translations.sh | 12 -- build-aux/assert-shellcheck.sh | 6 - build-aux/assert-spelling.sh | 35 ----- build-aux/ci/ci-build.sh | 53 ------- build-aux/ci/git-post-receive.sh | 14 -- build-aux/ci/git-pre-push.sh | 19 --- build-aux/extract-translations.sh | 15 -- build-aux/guix/manifest.scm | 15 -- build-aux/guix/pinned-channels.scm | 11 -- build-aux/guix/with-container.sh | 4 - build-aux/spelling/en.txt | 70 ---------- build-aux/spelling/eo.txt | 11 -- build-aux/spelling/fr.txt | 8 -- build-aux/spelling/international.txt | 264 ----------------------------------- build-aux/spelling/pt.txt | 134 ------------------ build-aux/workflow/TODOs.sh | 23 --- build-aux/workflow/assert-todos.sh | 57 -------- build-aux/workflow/preamble.md | 16 --- build-aux/workflow/style.css | 38 ----- scripts/apply-translations.sh | 12 ++ scripts/assert-spelling.sh | 35 +++++ scripts/extract-translations.sh | 15 ++ scripts/spelling/en.txt | 70 ++++++++++ scripts/spelling/eo.txt | 11 ++ scripts/spelling/fr.txt | 8 ++ scripts/spelling/international.txt | 264 +++++++++++++++++++++++++++++++++++ scripts/spelling/pt.txt | 134 ++++++++++++++++++ 40 files changed, 813 insertions(+), 812 deletions(-) create mode 100755 aux/assert-shellcheck.sh create mode 100755 aux/ci/ci-build.sh create mode 100755 aux/ci/git-post-receive.sh create mode 100755 aux/ci/git-pre-push.sh create mode 100644 aux/guix/manifest.scm create mode 100644 aux/guix/pinned-channels.scm create mode 100755 aux/guix/with-container.sh create mode 100755 aux/workflow/TODOs.sh create mode 100755 aux/workflow/assert-todos.sh create mode 100644 aux/workflow/preamble.md create mode 100644 aux/workflow/style.css delete mode 100755 build-aux/apply-translations.sh delete mode 100755 build-aux/assert-shellcheck.sh delete mode 100755 build-aux/assert-spelling.sh delete mode 100755 build-aux/ci/ci-build.sh delete mode 100755 build-aux/ci/git-post-receive.sh delete mode 100755 build-aux/ci/git-pre-push.sh delete mode 100755 build-aux/extract-translations.sh delete mode 100644 build-aux/guix/manifest.scm delete mode 100644 build-aux/guix/pinned-channels.scm delete mode 100755 build-aux/guix/with-container.sh delete mode 100644 build-aux/spelling/en.txt delete mode 100644 build-aux/spelling/eo.txt delete mode 100644 build-aux/spelling/fr.txt delete mode 100644 build-aux/spelling/international.txt delete mode 100644 build-aux/spelling/pt.txt delete mode 100755 build-aux/workflow/TODOs.sh delete mode 100755 build-aux/workflow/assert-todos.sh delete mode 100644 build-aux/workflow/preamble.md delete mode 100644 build-aux/workflow/style.css create mode 100755 scripts/apply-translations.sh create mode 100755 scripts/assert-spelling.sh create mode 100755 scripts/extract-translations.sh create mode 100644 scripts/spelling/en.txt create mode 100644 scripts/spelling/eo.txt create mode 100644 scripts/spelling/fr.txt create mode 100644 scripts/spelling/international.txt create mode 100644 scripts/spelling/pt.txt diff --git a/Makefile b/Makefile index 8d910e3..1870865 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ .PHONY: check check: - sh build-aux/assert-spelling.sh - sh build-aux/assert-shellcheck.sh - sh build-aux/workflow/assert-todos.sh - sh build-aux/extract-translations.sh - sh build-aux/apply-translations.sh + sh aux/assert-shellcheck.sh + sh aux/workflow/assert-todos.sh + sh scripts/assert-spelling.sh + sh scripts/extract-translations.sh + sh scripts/apply-translations.sh .PHONY: clean clean: @@ -18,4 +18,4 @@ OUT = public .PHONY: public public: JEKYLL_ENV=production jekyll build -d $(OUT) --trace - sh build-aux/workflow/TODOs.sh $(NAME_UC) $(NAME) $(MAILING_LIST) + sh aux/workflow/TODOs.sh $(NAME_UC) $(NAME) $(MAILING_LIST) diff --git a/_config.yml b/_config.yml index d58209e..2a67538 100644 --- a/_config.yml +++ b/_config.yml @@ -29,7 +29,8 @@ exclude: - Gemfile.lock - README - TODOs.md - - build-aux/ + - aux/ + - scripts/ - COPYING - default.nix - shell.nix diff --git a/aux/assert-shellcheck.sh b/aux/assert-shellcheck.sh new file mode 100755 index 0000000..334a875 --- /dev/null +++ b/aux/assert-shellcheck.sh @@ -0,0 +1,6 @@ +#!/bin/sh +set -eux + +git ls-files -z | \ + xargs -0 awk 'FNR==1 && /^#!\/bin\/sh$/ { print FILENAME }' | \ + xargs shellcheck diff --git a/aux/ci/ci-build.sh b/aux/ci/ci-build.sh new file mode 100755 index 0000000..c891d3b --- /dev/null +++ b/aux/ci/ci-build.sh @@ -0,0 +1,53 @@ +#!/bin/sh +set -eux + +PACKAGE="$1" +LOGS_DIR="$2" +read -r _ SHA _ # oldrev newrev refname +FILENAME="$(date -Is)-$SHA.log" +LOGFILE="$LOGS_DIR/$FILENAME" + +{ + echo "Starting CI job at: $(date -Is)" + + finish() { + STATUS="$?" + printf "\n\n>>> exit status was %s\n" "$STATUS" + echo "Finishing CI job at: $(date -Is)" + cd - + NOTE=$(cat <>>\n>>> CI logs added as Git note.\n>>>\n>>> Run status was %s" "$STATUS" + } + trap finish EXIT + + unset GIT_DIR + CLONE="$(mktemp -d)" + git clone . "$CLONE" + cd "$CLONE" + git config --global user.email git@euandre.org + git config --global user.name 'EuAndreh CI' + + if [ -f aux/guix/with-container.sh ]; then + RUNNER='./aux/guix/with-container.sh' + else + RUNNER='sh -c' + fi + + if [ -f ./bootstrap ]; then + COMMAND='./bootstrap && ./configure --enable-programmer-mode --enable-ci-mode && make clean all check distcheck public' + else + COMMAND='make clean check public' + fi + + $RUNNER "$COMMAND" + + rsync -avzzP public/ "/srv/http/$PACKAGE/" --delete +} | tee "$LOGFILE" 2>&1 diff --git a/aux/ci/git-post-receive.sh b/aux/ci/git-post-receive.sh new file mode 100755 index 0000000..2f6e3c0 --- /dev/null +++ b/aux/ci/git-post-receive.sh @@ -0,0 +1,14 @@ +#!/bin/sh +set -eu + +for n in $(seq 0 $((GIT_PUSH_OPTION_COUNT - 1))); do + opt="$(eval "echo \$GIT_PUSH_OPTION_$n")" + if [ "$opt" = skip-ci ] || [ "$opt" = ci-skip ]; then + printf "\n'%s' option detected, not running ci-build.sh\n\n" "$opt" + exit 0 + fi +done + +PACKAGE="$(basename "$PWD" | cut -d. -f1)" # remove .git suffix +LOGS_DIR="/data/ci/$PACKAGE/logs" +"/data/ci/$PACKAGE/ci-build.sh" "$PACKAGE" "$LOGS_DIR" diff --git a/aux/ci/git-pre-push.sh b/aux/ci/git-pre-push.sh new file mode 100755 index 0000000..30d2850 --- /dev/null +++ b/aux/ci/git-pre-push.sh @@ -0,0 +1,19 @@ +#!/bin/sh +set -eux + +PACKAGE="$(basename "$PWD")" +LOGS_DIR="/data/ci/$PACKAGE/logs" +REMOTE_GIT_DIR="/data/git/$PACKAGE.git" + +DESCRIPTION="$(mktemp)" +if [ -f description ] +then + cp description "$DESCRIPTION" +else + git config euandreh.description > "$DESCRIPTION" +fi + +scp "$DESCRIPTION" "git.euandreh.xyz:$REMOTE_GIT_DIR/description" +ssh git.euandreh.xyz mkdir -p "$LOGS_DIR" +scp aux/ci/ci-build.sh "git.euandreh.xyz:$(dirname "$LOGS_DIR")/ci-build.sh" +scp aux/ci/git-post-receive.sh "git.euandreh.xyz:$REMOTE_GIT_DIR/hooks/post-receive" diff --git a/aux/guix/manifest.scm b/aux/guix/manifest.scm new file mode 100644 index 0000000..0c8a225 --- /dev/null +++ b/aux/guix/manifest.scm @@ -0,0 +1,15 @@ +(specifications->manifest + (map symbol->string + '(coreutils + findutils + diffutils + grep + sed + git + tar + gzip + gawk + make + perl + shellcheck + pandoc))) diff --git a/aux/guix/pinned-channels.scm b/aux/guix/pinned-channels.scm new file mode 100644 index 0000000..67b5a51 --- /dev/null +++ b/aux/guix/pinned-channels.scm @@ -0,0 +1,11 @@ +(list + (channel + (name 'guix) + (url "https://git.savannah.gnu.org/git/guix.git") + (commit + "d265809b782293eb42dd663b4611ca19dd2bf1b3") + (introduction + (make-channel-introduction + "9edb3f66fd807b096b48283debdcddccfea34bad" + (openpgp-fingerprint + "BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA"))))) diff --git a/aux/guix/with-container.sh b/aux/guix/with-container.sh new file mode 100755 index 0000000..db7b121 --- /dev/null +++ b/aux/guix/with-container.sh @@ -0,0 +1,4 @@ +#!/bin/sh +set -eux + +guix time-machine -C aux/guix/pinned-channels.scm -- environment --pure -C -m aux/guix/manifest.scm -- sh -c "$@" diff --git a/aux/workflow/TODOs.sh b/aux/workflow/TODOs.sh new file mode 100755 index 0000000..ab45835 --- /dev/null +++ b/aux/workflow/TODOs.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -eu + +mkdir -p public + +export PROJECT_UC="$1" +export PROJECT="$2" +export MAILING_LIST="$3" + +REGEX='s/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE) (.*) \{#(.*?)\}$/## \1<\/span> \2<\/a>\n#\3<\/span>\n/' + +envsubst < aux/workflow/preamble.md | \ + printf '%s\n\n%s' "$(cat -)" "$(perl -pe "$REGEX" TODOs.md)" | \ + pandoc --toc \ + --highlight-style pygments \ + --toc-depth=2 \ + -s \ + --metadata title="$PROJECT_UC - TODOs" \ + --metadata lang=en \ + -r markdown \ + -w html \ + -H aux/workflow/style.css \ + > public/TODOs.html diff --git a/aux/workflow/assert-todos.sh b/aux/workflow/assert-todos.sh new file mode 100755 index 0000000..203d465 --- /dev/null +++ b/aux/workflow/assert-todos.sh @@ -0,0 +1,57 @@ +#!/bin/sh +set -eu + +if git grep FIXME | grep -v '^TODOs.md' | grep -v '^aux/workflow/assert-todos.sh' | grep -v '^aux/docbook-xsl/'; then + echo "Found dangling FIXME markers on the project." + echo "You should write them down properly on TODOs.md." + exit 1 +fi + +awk -F'{#' ' +BEGIN { + exitstatus = 0 + h2flag = 0 + h2status = "" + prevline = "" + idx = 0 + delete ids[0] +} +h2flag == 1 { + split($0, l, " ") + timelinestatus = l[2] + if (h2status != timelinestatus) { + print "h2/timeline status mismatch for line " NR-1 + print prevline + print $0 + exitstatus = 1 + } + h2status = "" + h2flag = 0 +} + +/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE)/ { + if (match($0, / \{#.*?\}$/) == 0) { + print "Missing ID for line " NR ":\n" $0 + exitstatus = 1 + } + id_with_prefix = substr($2, 0, length($2) - 1) + match(id_with_prefix, /^\w+-/) + id = substr(id_with_prefix, RLENGTH + 1) + if (id in arr) { + print "Duplicate ID: " id + exitstatus = 1 + } else { + arr[id] = 1 + } + + split($0, l, " ") + h2status = l[2] + h2flag = 1 + prevline = $0 +} + + +/^# Scratch$/ { + exit exitstatus +} +' TODOs.md diff --git a/aux/workflow/preamble.md b/aux/workflow/preamble.md new file mode 100644 index 0000000..c6ae56e --- /dev/null +++ b/aux/workflow/preamble.md @@ -0,0 +1,16 @@ +# About + +TODOs for $PROJECT_UC. + +See also [$PROJECT.euandreh.xyz](https://$PROJECT.euandreh.xyz/). + +Register a new one at +[~euandreh/$MAILING_LIST@lists.sr.ht](mailto:~euandreh/$MAILING_LIST@lists.sr.ht?subject=%5B$PROJECT%5D%20BUG%20or%20TASK%3A%20%3Cdescription%3E) +and see [existing discussions](https://lists.sr.ht/~euandreh/$MAILING_LIST?search=%5B$PROJECT%5D). + +*Você também pode escrever em português*. + +*Vous pouvez aussi écrire en français*. + +*Vi povas ankaŭ skribi esperante*. + diff --git a/aux/workflow/style.css b/aux/workflow/style.css new file mode 100644 index 0000000..ac0144c --- /dev/null +++ b/aux/workflow/style.css @@ -0,0 +1,38 @@ + diff --git a/build-aux/apply-translations.sh b/build-aux/apply-translations.sh deleted file mode 100755 index 190b777..0000000 --- a/build-aux/apply-translations.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -set -eu - -for f in $(git ls-files | grep -E '.(md|slides)$' | grep -Ev '^(vendor/reveal.js|TODOs.md|build-aux/)'); do - l="$(grep '^lang: ..$' "$f" | awk '{print $2}')" - if [ "$l" != 'en' ]; then - ref="$(grep '^ref: ' "$f" | awk '{print $2}')" - # shellcheck disable=2046 - FROM=$(find $(find . -type f -name '*.md' -exec grep -l "^ref: $ref$" {} \;) -type f -exec grep -l '^lang: en$' {} \;) - po2md "$FROM" --pofiles "locale/$l/LC_MESSAGES/${FROM%.md}.po" --quiet --save "$f" - fi -done diff --git a/build-aux/assert-shellcheck.sh b/build-aux/assert-shellcheck.sh deleted file mode 100755 index 334a875..0000000 --- a/build-aux/assert-shellcheck.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -set -eux - -git ls-files -z | \ - xargs -0 awk 'FNR==1 && /^#!\/bin\/sh$/ { print FILENAME }' | \ - xargs shellcheck diff --git a/build-aux/assert-spelling.sh b/build-aux/assert-spelling.sh deleted file mode 100755 index 33da3e3..0000000 --- a/build-aux/assert-spelling.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh -set -eu - -export LANG=C.UTF-8 -export JEKYLL_ENV=production - -for DICT in build-aux/spelling/*.txt; do - sort "$DICT" | diff - "$DICT" || { - echo "The $DICT dictionary is unsorted. To fix it, run:" >&2 - echo " LANG=C.UTF-8 sort $DICT | sponge $DICT" >&2 - exit 1 - } -done - -OUT="$(mktemp)" -jekyll build --future --trace -# shellcheck disable=2044 -for f in $(find _site -type f -name '*.html'); do - if ! echo "$f" | grep -qE '(/vendor/|TODOs.html)'; then - l="$(head -n2 "$f" | tail -n1 | cut -d\" -f2)" - CURR_DICT="$(mktemp)" - cat build-aux/spelling/international.txt "build-aux/spelling/$l.txt" > "$CURR_DICT" - hunspell -u3 -H -d "$l" -p "$CURR_DICT" "$f" | tee -a "$OUT" - fi -done - -if [ -s "$OUT" ]; then - printf "\nvvv Mispelled words detected by hunspell.\n\n" - cut -d\ -f2- < "$OUT" | sort | uniq - printf "\n^^^\n" >&2 - exit 1 -else - echo "No spelling errors detected" - exit 0 -fi diff --git a/build-aux/ci/ci-build.sh b/build-aux/ci/ci-build.sh deleted file mode 100755 index 0b792df..0000000 --- a/build-aux/ci/ci-build.sh +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -set -eux - -PACKAGE="$1" -LOGS_DIR="$2" -read -r _ SHA _ # oldrev newrev refname -FILENAME="$(date -Is)-$SHA.log" -LOGFILE="$LOGS_DIR/$FILENAME" - -{ - echo "Starting CI job at: $(date -Is)" - - finish() { - STATUS="$?" - printf "\n\n>>> exit status was %s\n" "$STATUS" - echo "Finishing CI job at: $(date -Is)" - cd - - NOTE=$(cat <>>\n>>> CI logs added as Git note.\n>>>\n>>> Run status was %s" "$STATUS" - } - trap finish EXIT - - unset GIT_DIR - CLONE="$(mktemp -d)" - git clone . "$CLONE" - cd "$CLONE" - git config --global user.email git@euandre.org - git config --global user.name 'EuAndreh CI' - - if [ -f build-aux/guix/with-container.sh ]; then - RUNNER='./build-aux/guix/with-container.sh' - else - RUNNER='sh -c' - fi - - if [ -f ./bootstrap ]; then - COMMAND='./bootstrap && ./configure --enable-programmer-mode --enable-ci-mode && make clean all check distcheck public' - else - COMMAND='make clean check public' - fi - - $RUNNER "$COMMAND" - - rsync -avzzP public/ "/srv/http/$PACKAGE/" --delete -} | tee "$LOGFILE" 2>&1 diff --git a/build-aux/ci/git-post-receive.sh b/build-aux/ci/git-post-receive.sh deleted file mode 100755 index 2f6e3c0..0000000 --- a/build-aux/ci/git-post-receive.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -set -eu - -for n in $(seq 0 $((GIT_PUSH_OPTION_COUNT - 1))); do - opt="$(eval "echo \$GIT_PUSH_OPTION_$n")" - if [ "$opt" = skip-ci ] || [ "$opt" = ci-skip ]; then - printf "\n'%s' option detected, not running ci-build.sh\n\n" "$opt" - exit 0 - fi -done - -PACKAGE="$(basename "$PWD" | cut -d. -f1)" # remove .git suffix -LOGS_DIR="/data/ci/$PACKAGE/logs" -"/data/ci/$PACKAGE/ci-build.sh" "$PACKAGE" "$LOGS_DIR" diff --git a/build-aux/ci/git-pre-push.sh b/build-aux/ci/git-pre-push.sh deleted file mode 100755 index 2d2bcb1..0000000 --- a/build-aux/ci/git-pre-push.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -set -eux - -PACKAGE="$(basename "$PWD")" -LOGS_DIR="/data/ci/$PACKAGE/logs" -REMOTE_GIT_DIR="/data/git/$PACKAGE.git" - -DESCRIPTION="$(mktemp)" -if [ -f description ] -then - cp description "$DESCRIPTION" -else - git config euandreh.description > "$DESCRIPTION" -fi - -scp "$DESCRIPTION" "git.euandreh.xyz:$REMOTE_GIT_DIR/description" -ssh git.euandreh.xyz mkdir -p "$LOGS_DIR" -scp build-aux/ci/ci-build.sh "git.euandreh.xyz:$(dirname "$LOGS_DIR")/ci-build.sh" -scp build-aux/ci/git-post-receive.sh "git.euandreh.xyz:$REMOTE_GIT_DIR/hooks/post-receive" diff --git a/build-aux/extract-translations.sh b/build-aux/extract-translations.sh deleted file mode 100755 index 2333865..0000000 --- a/build-aux/extract-translations.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -set -eu - -TRANSLATIONS='pt fr eo' - -for f in $(git ls-files | grep -E '.(md|slides)$' | grep -v '^vendor/reveal.js$'); do - file_lang="$(grep '^lang: ..$' "$f" | awk '{print $2}')" - if [ "$file_lang" = 'en' ]; then - for l in $TRANSLATIONS; do - OUT="locale/$l/LC_MESSAGES/${f%.md}.po" - mkdir -p "$(dirname "$OUT")" - md2po "$f" --include-codeblocks --quiet --save --po-filepath "$OUT" - done - fi -done diff --git a/build-aux/guix/manifest.scm b/build-aux/guix/manifest.scm deleted file mode 100644 index 0c8a225..0000000 --- a/build-aux/guix/manifest.scm +++ /dev/null @@ -1,15 +0,0 @@ -(specifications->manifest - (map symbol->string - '(coreutils - findutils - diffutils - grep - sed - git - tar - gzip - gawk - make - perl - shellcheck - pandoc))) diff --git a/build-aux/guix/pinned-channels.scm b/build-aux/guix/pinned-channels.scm deleted file mode 100644 index 67b5a51..0000000 --- a/build-aux/guix/pinned-channels.scm +++ /dev/null @@ -1,11 +0,0 @@ -(list - (channel - (name 'guix) - (url "https://git.savannah.gnu.org/git/guix.git") - (commit - "d265809b782293eb42dd663b4611ca19dd2bf1b3") - (introduction - (make-channel-introduction - "9edb3f66fd807b096b48283debdcddccfea34bad" - (openpgp-fingerprint - "BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA"))))) diff --git a/build-aux/guix/with-container.sh b/build-aux/guix/with-container.sh deleted file mode 100755 index 5969d38..0000000 --- a/build-aux/guix/with-container.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -set -eux - -guix time-machine -C build-aux/guix/pinned-channels.scm -- environment --pure -C -m build-aux/guix/manifest.scm -- sh -c "$@" diff --git a/build-aux/spelling/en.txt b/build-aux/spelling/en.txt deleted file mode 100644 index d54b934..0000000 --- a/build-aux/spelling/en.txt +++ /dev/null @@ -1,70 +0,0 @@ -Bashisms -Patches -Rollout -Slides -acyclic -analytics -aren -autocommit -backend -balancer -barcode -behaviour -centric -chargeback -combinators -config -couldn -cronjobs -culting -curation -dataset -declaratively -decrypting -definitionally -demoer -didactical -didn -differentiator -directionality -doesn -duplications -dynamicity -embeddable -english -exps -filesystem -filesystems -influent -isn -iteratively -maintainence -oday -parameterization -parameterizing -performant -podcatcher -portuguese -pre -preventively -programmatically -realising -reimplementation -repo -reproducibility -reusability -sandboxed -scriptable -shouldn -symlinks -syncable -só -tradeoffs -unintuitive -unmastered -untrusted -unwatched -ve -wasn -whiteboarding -wouldn diff --git a/build-aux/spelling/eo.txt b/build-aux/spelling/eo.txt deleted file mode 100644 index 8629511..0000000 --- a/build-aux/spelling/eo.txt +++ /dev/null @@ -1,11 +0,0 @@ -- -CC -CD -EC -H -HML -L -M -Podkastaĵoj -ernis -odiaŭ diff --git a/build-aux/spelling/fr.txt b/build-aux/spelling/fr.txt deleted file mode 100644 index aa09184..0000000 --- a/build-aux/spelling/fr.txt +++ /dev/null @@ -1,8 +0,0 @@ -' -AJA -dimanche -earned -oday -ppris -só -ujourd'hui diff --git a/build-aux/spelling/international.txt b/build-aux/spelling/international.txt deleted file mode 100644 index d87507e..0000000 --- a/build-aux/spelling/international.txt +++ /dev/null @@ -1,264 +0,0 @@ -144p -1D -250GB -2D -2nix -32GB -500GB -81F90EC3CD356060 -8GB -ABloibce -AGPLv -AGPLv3 -APIs -Agustín -AliceBob -André -Anna -Atom -Awk -B1 -BN -BSON -BY -BY-SA -Barrios -Binet -Bitbucket -BobAlice -CDN -CI -CLI -CRDT -CRDTs -Canhoto -Cantrill -Choro -Clojure -CoreData -CouchDB -DIY -DOM -DVCS -Datomic -Dengoso -EuAndreh -F -FFI -FP -FTS -Fastmail -Feldman -Forsgren -Freenode -GADTs -GTK -GitLab -Gmail -GoCD -GuixSD -HN -HTML -HTTPS -Halloway -Hardenberg -Haskell -Henney -Hodgson -I -IPs -ImmutableJS -IndexedDB -JS -JSON -Joyent -João -Kevlin -Kleppmann -L1 -LSM -LTS -LaTeX -Lerna -LilyPond -LiquidHaskell -MTA -Mailutils -Makefile -Marcha -Marinheiros -Matroska -McGranaghan -Mentat -Merkle -NPM -Neomutt -Nextcloud -NixOS -Nixpkgs -OOP -OTP -PNG -POSIX -ParsecC -Pastebin -Pavlo -Pernambuco -Petrov -Pittet -PoC -PouchDB -RDF -README -RPC -RPN -RSS -Raku -Reddit -Redux -SA -SMTP -SSD -SSMTP -STDIN -STDOUT -SVG -Saudade -Screencast -Screencasts -ShellCheck -Slava -Sourcehut -Spacemacs -StackOverflow -Staltz -Sten -T -TAB -TBs -TILs -TOML -Théodore -TypeScript -UI -URL -VPN -WebAssembly -WebTorrent -Wollrath -Wyant -Yandex -YouTube -Zig -apk -automerge -awk -bindgen -blockchain -boneco -br -brainer -buildGoModule -cURL -cargo2nix -carte -cbindgen -cgit -ci -clojure -cronjob -da -datalog -datom -datoms -divoplade -dl -dmenu -dos -e -earned -edn -en -eo -euandre -euandreh -eval -executables -favicon -ffi -fi -fr -frontend -fzf -gPodder -gcrypt -ge -getopts -gt -guix -guixbuild -h1 -h6 -html -https -i5 -i7 -ify -immer -intbytes -ios -ish -jekyll -jemoji -js -k8s -kramdown -kubernetes -libedn -lockfile -lockfiles -lt -memtable -memtables -merkle -myrepos -nixos -no-brainer -node2nix -noinform -npm -oday -org -pastebin -pastebins -plaintext -positionally -pouchdb -progn -pt -rollout -rollouts -sbcl -screencast -screencasts -sed -songbooks -sourcehut -sr -swift2nix -systemd -só -torrent -touchpad -troff -txt -v0 -v8 -vlog -webtorrent -www -xp -xyz -yeganesh -youtube -à diff --git a/build-aux/spelling/pt.txt b/build-aux/spelling/pt.txt deleted file mode 100644 index c7da56d..0000000 --- a/build-aux/spelling/pt.txt +++ /dev/null @@ -1,134 +0,0 @@ -Abaixo -Agosto -Aprendi -Atualizado -Blog -Comente -Cópia -H -HEA -I -L -Lista -Me -Patches -Podcast -Postado -Postagens -Quando -T -Usar -Visite -Website -achar -arquivo -artigos -buscar -categoria -chegar -comece -comentário -como -completar -conhecimentos -contatar -criar -código -da -dados -de -desta -diretamente -direto -discussão -discussões -distribuir -do -dobráveis -dou eu -e -earned -email -empacotá -encontra -engasgo -entrada -envelope -escreva -escrever -escrevo -esforço -estou -eu -exemplo -existentes -extra -fazer -ficou -formatos -gerar -impressão -inglês -interessantes -internet -intervalos -jeito -las -licenciado -licença -log -los -mandar -mande -me -mensagem -mostrar -na -navegador -no -nome -normalmente -novo -o -oday -oje -ordená -os -padrão -para -parar -pessoal -podcast -por -post -postagens -prendi -procurando -procure -produção -projetos -pública -público -relacionados -reler -religioso -se -shell -significa -simples -sobre -tempo -teste -texto -timestamp -transpor -u -usando -usar -veja -versão -versões -vindas -Ícone -é -úteis diff --git a/build-aux/workflow/TODOs.sh b/build-aux/workflow/TODOs.sh deleted file mode 100755 index 3f9fa4b..0000000 --- a/build-aux/workflow/TODOs.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -set -eu - -mkdir -p public - -export PROJECT_UC="$1" -export PROJECT="$2" -export MAILING_LIST="$3" - -REGEX='s/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE) (.*) \{#(.*?)\}$/## \1<\/span> \2<\/a>\n#\3<\/span>\n/' - -envsubst < build-aux/workflow/preamble.md | \ - printf '%s\n\n%s' "$(cat -)" "$(perl -pe "$REGEX" TODOs.md)" | \ - pandoc --toc \ - --highlight-style pygments \ - --toc-depth=2 \ - -s \ - --metadata title="$PROJECT_UC - TODOs" \ - --metadata lang=en \ - -r markdown \ - -w html \ - -H build-aux/workflow/style.css \ - > public/TODOs.html diff --git a/build-aux/workflow/assert-todos.sh b/build-aux/workflow/assert-todos.sh deleted file mode 100755 index 1d568cb..0000000 --- a/build-aux/workflow/assert-todos.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -set -eu - -if git grep FIXME | grep -v '^TODOs.md' | grep -v '^build-aux/workflow/assert-todos.sh' | grep -v '^build-aux/docbook-xsl/'; then - echo "Found dangling FIXME markers on the project." - echo "You should write them down properly on TODOs.md." - exit 1 -fi - -awk -F'{#' ' -BEGIN { - exitstatus = 0 - h2flag = 0 - h2status = "" - prevline = "" - idx = 0 - delete ids[0] -} -h2flag == 1 { - split($0, l, " ") - timelinestatus = l[2] - if (h2status != timelinestatus) { - print "h2/timeline status mismatch for line " NR-1 - print prevline - print $0 - exitstatus = 1 - } - h2status = "" - h2flag = 0 -} - -/^## (TODO|DOING|WAITING|MEETING|INACTIVE|NEXT|CANCELLED|DONE)/ { - if (match($0, / \{#.*?\}$/) == 0) { - print "Missing ID for line " NR ":\n" $0 - exitstatus = 1 - } - id_with_prefix = substr($2, 0, length($2) - 1) - match(id_with_prefix, /^\w+-/) - id = substr(id_with_prefix, RLENGTH + 1) - if (id in arr) { - print "Duplicate ID: " id - exitstatus = 1 - } else { - arr[id] = 1 - } - - split($0, l, " ") - h2status = l[2] - h2flag = 1 - prevline = $0 -} - - -/^# Scratch$/ { - exit exitstatus -} -' TODOs.md diff --git a/build-aux/workflow/preamble.md b/build-aux/workflow/preamble.md deleted file mode 100644 index c6ae56e..0000000 --- a/build-aux/workflow/preamble.md +++ /dev/null @@ -1,16 +0,0 @@ -# About - -TODOs for $PROJECT_UC. - -See also [$PROJECT.euandreh.xyz](https://$PROJECT.euandreh.xyz/). - -Register a new one at -[~euandreh/$MAILING_LIST@lists.sr.ht](mailto:~euandreh/$MAILING_LIST@lists.sr.ht?subject=%5B$PROJECT%5D%20BUG%20or%20TASK%3A%20%3Cdescription%3E) -and see [existing discussions](https://lists.sr.ht/~euandreh/$MAILING_LIST?search=%5B$PROJECT%5D). - -*Você também pode escrever em português*. - -*Vous pouvez aussi écrire en français*. - -*Vi povas ankaŭ skribi esperante*. - diff --git a/build-aux/workflow/style.css b/build-aux/workflow/style.css deleted file mode 100644 index ac0144c..0000000 --- a/build-aux/workflow/style.css +++ /dev/null @@ -1,38 +0,0 @@ - diff --git a/scripts/apply-translations.sh b/scripts/apply-translations.sh new file mode 100755 index 0000000..5920717 --- /dev/null +++ b/scripts/apply-translations.sh @@ -0,0 +1,12 @@ +#!/bin/sh +set -eu + +for f in $(git ls-files | grep -E '.(md|slides)$' | grep -Ev '^(vendor/reveal.js|TODOs.md|aux/)'); do + l="$(grep '^lang: ..$' "$f" | awk '{print $2}')" + if [ "$l" != 'en' ]; then + ref="$(grep '^ref: ' "$f" | awk '{print $2}')" + # shellcheck disable=2046 + FROM=$(find $(find . -type f -name '*.md' -exec grep -l "^ref: $ref$" {} \;) -type f -exec grep -l '^lang: en$' {} \;) + po2md "$FROM" --pofiles "locale/$l/LC_MESSAGES/${FROM%.md}.po" --quiet --save "$f" + fi +done diff --git a/scripts/assert-spelling.sh b/scripts/assert-spelling.sh new file mode 100755 index 0000000..f0053b4 --- /dev/null +++ b/scripts/assert-spelling.sh @@ -0,0 +1,35 @@ +#!/bin/sh +set -eu + +export LANG=C.UTF-8 +export JEKYLL_ENV=production + +for DICT in scripts/spelling/*.txt; do + sort "$DICT" | diff - "$DICT" || { + echo "The $DICT dictionary is unsorted. To fix it, run:" >&2 + echo " LANG=C.UTF-8 sort $DICT | sponge $DICT" >&2 + exit 1 + } +done + +OUT="$(mktemp)" +jekyll build --future --trace +# shellcheck disable=2044 +for f in $(find _site -type f -name '*.html'); do + if ! echo "$f" | grep -qE '(/vendor/|TODOs.html)'; then + l="$(head -n2 "$f" | tail -n1 | cut -d\" -f2)" + CURR_DICT="$(mktemp)" + cat scripts/spelling/international.txt "scripts/spelling/$l.txt" > "$CURR_DICT" + hunspell -u3 -H -d "$l" -p "$CURR_DICT" "$f" | tee -a "$OUT" + fi +done + +if [ -s "$OUT" ]; then + printf "\nvvv Mispelled words detected by hunspell.\n\n" + cut -d\ -f2- < "$OUT" | sort | uniq + printf "\n^^^\n" >&2 + exit 1 +else + echo "No spelling errors detected" + exit 0 +fi diff --git a/scripts/extract-translations.sh b/scripts/extract-translations.sh new file mode 100755 index 0000000..2333865 --- /dev/null +++ b/scripts/extract-translations.sh @@ -0,0 +1,15 @@ +#!/bin/sh +set -eu + +TRANSLATIONS='pt fr eo' + +for f in $(git ls-files | grep -E '.(md|slides)$' | grep -v '^vendor/reveal.js$'); do + file_lang="$(grep '^lang: ..$' "$f" | awk '{print $2}')" + if [ "$file_lang" = 'en' ]; then + for l in $TRANSLATIONS; do + OUT="locale/$l/LC_MESSAGES/${f%.md}.po" + mkdir -p "$(dirname "$OUT")" + md2po "$f" --include-codeblocks --quiet --save --po-filepath "$OUT" + done + fi +done diff --git a/scripts/spelling/en.txt b/scripts/spelling/en.txt new file mode 100644 index 0000000..d54b934 --- /dev/null +++ b/scripts/spelling/en.txt @@ -0,0 +1,70 @@ +Bashisms +Patches +Rollout +Slides +acyclic +analytics +aren +autocommit +backend +balancer +barcode +behaviour +centric +chargeback +combinators +config +couldn +cronjobs +culting +curation +dataset +declaratively +decrypting +definitionally +demoer +didactical +didn +differentiator +directionality +doesn +duplications +dynamicity +embeddable +english +exps +filesystem +filesystems +influent +isn +iteratively +maintainence +oday +parameterization +parameterizing +performant +podcatcher +portuguese +pre +preventively +programmatically +realising +reimplementation +repo +reproducibility +reusability +sandboxed +scriptable +shouldn +symlinks +syncable +só +tradeoffs +unintuitive +unmastered +untrusted +unwatched +ve +wasn +whiteboarding +wouldn diff --git a/scripts/spelling/eo.txt b/scripts/spelling/eo.txt new file mode 100644 index 0000000..8629511 --- /dev/null +++ b/scripts/spelling/eo.txt @@ -0,0 +1,11 @@ +- +CC +CD +EC +H +HML +L +M +Podkastaĵoj +ernis +odiaŭ diff --git a/scripts/spelling/fr.txt b/scripts/spelling/fr.txt new file mode 100644 index 0000000..aa09184 --- /dev/null +++ b/scripts/spelling/fr.txt @@ -0,0 +1,8 @@ +' +AJA +dimanche +earned +oday +ppris +só +ujourd'hui diff --git a/scripts/spelling/international.txt b/scripts/spelling/international.txt new file mode 100644 index 0000000..d87507e --- /dev/null +++ b/scripts/spelling/international.txt @@ -0,0 +1,264 @@ +144p +1D +250GB +2D +2nix +32GB +500GB +81F90EC3CD356060 +8GB +ABloibce +AGPLv +AGPLv3 +APIs +Agustín +AliceBob +André +Anna +Atom +Awk +B1 +BN +BSON +BY +BY-SA +Barrios +Binet +Bitbucket +BobAlice +CDN +CI +CLI +CRDT +CRDTs +Canhoto +Cantrill +Choro +Clojure +CoreData +CouchDB +DIY +DOM +DVCS +Datomic +Dengoso +EuAndreh +F +FFI +FP +FTS +Fastmail +Feldman +Forsgren +Freenode +GADTs +GTK +GitLab +Gmail +GoCD +GuixSD +HN +HTML +HTTPS +Halloway +Hardenberg +Haskell +Henney +Hodgson +I +IPs +ImmutableJS +IndexedDB +JS +JSON +Joyent +João +Kevlin +Kleppmann +L1 +LSM +LTS +LaTeX +Lerna +LilyPond +LiquidHaskell +MTA +Mailutils +Makefile +Marcha +Marinheiros +Matroska +McGranaghan +Mentat +Merkle +NPM +Neomutt +Nextcloud +NixOS +Nixpkgs +OOP +OTP +PNG +POSIX +ParsecC +Pastebin +Pavlo +Pernambuco +Petrov +Pittet +PoC +PouchDB +RDF +README +RPC +RPN +RSS +Raku +Reddit +Redux +SA +SMTP +SSD +SSMTP +STDIN +STDOUT +SVG +Saudade +Screencast +Screencasts +ShellCheck +Slava +Sourcehut +Spacemacs +StackOverflow +Staltz +Sten +T +TAB +TBs +TILs +TOML +Théodore +TypeScript +UI +URL +VPN +WebAssembly +WebTorrent +Wollrath +Wyant +Yandex +YouTube +Zig +apk +automerge +awk +bindgen +blockchain +boneco +br +brainer +buildGoModule +cURL +cargo2nix +carte +cbindgen +cgit +ci +clojure +cronjob +da +datalog +datom +datoms +divoplade +dl +dmenu +dos +e +earned +edn +en +eo +euandre +euandreh +eval +executables +favicon +ffi +fi +fr +frontend +fzf +gPodder +gcrypt +ge +getopts +gt +guix +guixbuild +h1 +h6 +html +https +i5 +i7 +ify +immer +intbytes +ios +ish +jekyll +jemoji +js +k8s +kramdown +kubernetes +libedn +lockfile +lockfiles +lt +memtable +memtables +merkle +myrepos +nixos +no-brainer +node2nix +noinform +npm +oday +org +pastebin +pastebins +plaintext +positionally +pouchdb +progn +pt +rollout +rollouts +sbcl +screencast +screencasts +sed +songbooks +sourcehut +sr +swift2nix +systemd +só +torrent +touchpad +troff +txt +v0 +v8 +vlog +webtorrent +www +xp +xyz +yeganesh +youtube +à diff --git a/scripts/spelling/pt.txt b/scripts/spelling/pt.txt new file mode 100644 index 0000000..c7da56d --- /dev/null +++ b/scripts/spelling/pt.txt @@ -0,0 +1,134 @@ +Abaixo +Agosto +Aprendi +Atualizado +Blog +Comente +Cópia +H +HEA +I +L +Lista +Me +Patches +Podcast +Postado +Postagens +Quando +T +Usar +Visite +Website +achar +arquivo +artigos +buscar +categoria +chegar +comece +comentário +como +completar +conhecimentos +contatar +criar +código +da +dados +de +desta +diretamente +direto +discussão +discussões +distribuir +do +dobráveis +dou eu +e +earned +email +empacotá +encontra +engasgo +entrada +envelope +escreva +escrever +escrevo +esforço +estou +eu +exemplo +existentes +extra +fazer +ficou +formatos +gerar +impressão +inglês +interessantes +internet +intervalos +jeito +las +licenciado +licença +log +los +mandar +mande +me +mensagem +mostrar +na +navegador +no +nome +normalmente +novo +o +oday +oje +ordená +os +padrão +para +parar +pessoal +podcast +por +post +postagens +prendi +procurando +procure +produção +projetos +pública +público +relacionados +reler +religioso +se +shell +significa +simples +sobre +tempo +teste +texto +timestamp +transpor +u +usando +usar +veja +versão +versões +vindas +Ícone +é +úteis -- cgit v1.2.3