#!/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// 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-) 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//; Wiki/Home.md is the index."