Files
institution/Tools/sync-wiki.sh
T
flan 3530100ed5 Aggregate the whole suite wiki onto the Institution page
Wiki/Home.md is the suite's front door; every layer's wiki now mirrors here
under Wiki/<layer>/ (core, contraband, justice, gangs, ward), so the whole
suite reads in one place with the index linking to the local pages. The
layer repos stay canonical -- Tools/sync-wiki.sh refreshes the aggregated
copy on demand. The README's main page points to it.
2026-07-15 20:30:38 +00:00

42 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Consolidate every layer's Wiki/ into THIS repo's Wiki/, so the Institution page is the single place
# to read the whole suite's documentation. Each layer's pages land under Wiki/<layer>/ with their own
# internal links intact. The layer repos stay the canonical source (each ships its own wiki for a
# standalone install); re-run this whenever a layer's wiki changes to re-sync the aggregated copy.
#
# Wiki/Home.md (the suite index) is hand-written and lives at the top level -- this script never
# touches it, only the per-layer subfolders.
#
# Usage: Tools/sync-wiki.sh (assumes siblings at ../rimworld-<name>)
set -euo pipefail
HERE="$(cd "$(dirname "$0")/.." && pwd)"
SIB="$(dirname "$HERE")"
# layer folder -> sibling repo
LAYERS=(
"core:rimworld-core"
"contraband:rimworld-contraband"
"justice:rimworld-justice"
"gangs:rimworld-gangs"
"ward:rimworld-ward"
)
echo "==> mirroring layer wikis into $HERE/Wiki/"
for entry in "${LAYERS[@]}"; do
layer="${entry%%:*}"
repo="${entry##*:}"
src="$SIB/$repo/Wiki"
dst="$HERE/Wiki/$layer"
if [[ -d "$src" ]]; then
rm -rf "$dst"
mkdir -p "$dst"
cp "$src"/*.md "$dst"/
echo " $layer: $(ls "$dst" | wc -l | tr -d ' ') pages"
else
echo " $layer: no Wiki/ in $repo -- skipped"
fi
done
echo "==> done. The Institution wiki now mirrors every layer under Wiki/<layer>/; Wiki/Home.md is the index."