Rebuild the website on the current PageTop API, with Bootsier as its
theme and edition 2024. Add the first Spanish guide (doc/v0.6/es) as an
mdBook book, built in build.rs and served with pagetop-mdbook, and the
/doc/latest/{lang} redirect.
Add `tools/doccheck.sh` to check the links of the guides and to compile,
run and test their examples against PageTop.
Move the configuration to config/common.toml and translate the README
to English.
41 lines
1.2 KiB
Bash
Executable file
41 lines
1.2 KiB
Bash
Executable file
#!/bin/bash
|
|
# Checks a book of the guides against the current PageTop code: its links, and that every Rust
|
|
# example compiles (and runs, if it is not marked `no_run`). See "Checking the guides" in README.md.
|
|
#
|
|
# Usage: tools/doccheck.sh [book dir] (default: the latest Spanish guide)
|
|
|
|
set -u
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
BOOK="$(cd "${1:-$ROOT/doc/v0.6/es}" && pwd)"
|
|
CRATE="$ROOT/tools/doccheck"
|
|
OUT="$CRATE/target/book"
|
|
FAILED=0
|
|
|
|
echo "== Links"
|
|
rm -rf "$OUT"
|
|
if mdbook build "$BOOK" -d "$OUT" >/dev/null 2>&1; then
|
|
python3 "$CRATE/check_links.py" "$OUT" || FAILED=1
|
|
else
|
|
echo "mdbook build failed"; FAILED=1
|
|
fi
|
|
|
|
echo "== Examples"
|
|
python3 "$CRATE/extract.py" "$BOOK/src" "$CRATE"
|
|
cd "$CRATE" || exit 1
|
|
if ! cargo build -j 2 --examples; then
|
|
FAILED=1
|
|
else
|
|
for example in examples/*_run.rs; do
|
|
[ -e "$example" ] || continue
|
|
name="$(basename "$example" .rs)"
|
|
if ! "./target/debug/examples/$name" >/dev/null; then
|
|
echo "run failed: $name"; FAILED=1
|
|
fi
|
|
done
|
|
fi
|
|
|
|
echo "== Tests"
|
|
cargo test -j 2 --tests || FAILED=1
|
|
|
|
if [ "$FAILED" -eq 0 ]; then echo "OK: the guide matches the current PageTop code"; fi
|
|
exit "$FAILED"
|