#!/usr/bin/env bash # Regenerate cases/.html and cases/.skeleton from orgo. # # The golden outputs are derived from orgo, the reference implementation — never edited by # hand. Point ORGO_DIR at an orgo checkout (default: ../orgo). Each case's .org input is # the source of truth for the input; this script only refreshes the two derived files. # # ORGO_DIR=../orgo tools/generate.sh set -euo pipefail here="$(cd "$(dirname "$0")/.." && pwd)" orgo="${ORGO_DIR:-$here/../orgo}" if [ ! -f "$orgo/Cargo.toml" ]; then echo "orgo checkout not found at $orgo (set ORGO_DIR)" >&2 exit 1 fi # One release-less build up front so the per-case runs are fast. ( cd "$orgo" && cargo build -q --example skeleton ) count=0 for org in "$here"/cases/*.org; do name="$(basename "$org" .org)" ( cd "$orgo" && cargo run -q --example skeleton -- --html "$org" ) > "$here/cases/$name.html" ( cd "$orgo" && cargo run -q --example skeleton -- "$org" ) > "$here/cases/$name.skeleton" count=$((count + 1)) echo " regenerated $name" done echo "done: $count cases"