From b3ee98bbb77d4e6d8ac3f0e0507cdb443b11271b Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Wed, 2 Dec 2020 15:41:18 -0300 Subject: Build and publish TODOs.org file --- scripts/assert-todos.sh | 32 ++++++++++++++++++++++++++++++++ scripts/ci-build.sh | 3 ++- scripts/generate-tasks-and-bugs.sh | 24 ++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 1 deletion(-) create mode 100755 scripts/generate-tasks-and-bugs.sh (limited to 'scripts') diff --git a/scripts/assert-todos.sh b/scripts/assert-todos.sh index 7c32524..c3139d1 100755 --- a/scripts/assert-todos.sh +++ b/scripts/assert-todos.sh @@ -9,3 +9,35 @@ if grep -R FIXME $(git ls-files) | grep -v '^TODOs.org' | grep -v '^.git/' | gre echo "You should write them down properly on TODOs.org." exit 1 fi + +contains-element() { + local e match="$1" + shift + for e; do [[ "$e" == "$match" ]] && return 0; done + return 1 +} + +KNOWN_IDS=() +has_error=0 +# shellcheck disable=2013 +for todo in $(sed -e '/^\* Tasks$/,/^\* Improvements$/!d' TODOs.org | grep -nE '^\*\* .*$' | cut -d: -f1); do + if grep -E '^\*\* (CANCELLED|DONE)' <(sed "${todo}q;d" TODOs.org) > /dev/null; then + ID_OFFSET=3 + else + ID_OFFSET=2 + fi + ID="$(sed "$((todo+ID_OFFSET))q;d" TODOs.org)" + if grep '^:CUSTOM_ID: .*$' <(echo "$ID") > /dev/null; then + if contains-element "$ID" "${KNOWN_IDS[@]}"; then + echo "Duplicated ID: $ID" + has_error=1 + else + KNOWN_IDS+=("$ID") + fi + else + echo "Missing ID for TODO in line $todo" + has_error=1 + fi +done + +exit "$has_error" diff --git a/scripts/ci-build.sh b/scripts/ci-build.sh index 9b89160..f8e3aa6 100755 --- a/scripts/ci-build.sh +++ b/scripts/ci-build.sh @@ -36,4 +36,5 @@ pushd "$CLONE" git config --global user.email git@euandre.org git config --global user.name 'EuAndreh CI' -./scripts/with-container.sh 'make check publish' +./scripts/with-container.sh 'make check public' +mv public/ /srv/http/vps/ diff --git a/scripts/generate-tasks-and-bugs.sh b/scripts/generate-tasks-and-bugs.sh new file mode 100755 index 0000000..cbbce29 --- /dev/null +++ b/scripts/generate-tasks-and-bugs.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -Eeuo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")" +cd ../ + +mkdir -p public + +cat workflow/vendor/org.css workflow/workflow.css > public/styles.css + +sed -e '/^\* Tasks$/,/^\* Improvements$/!d' TODOs.org | \ + head -n -1 | \ + cat workflow/preamble.org - > tasks-and-bugs.org + +emacs tasks-and-bugs.org \ + -l workflow/vendor/htmlize.el \ + --eval '(setq org-export-allow-bind-keywords t)' \ + -f org-html-export-to-html \ + --batch \ + --kill + +# Add anchor link to bug headers +perl -pe \ + 's|^

(.*)

$|

\2
#\1

|' \ + tasks-and-bugs.html > public/tasks-and-bugs.html -- cgit v1.2.3