1# private, then public again: going private takes the repo's pages, its2# entries on the index, owner pages and repos.json, its sites, previews and3# their hostnames off the forge, and the mirror's next sync sees it gone;4# its pages move to the private root, and pushes meanwhile build there and5# deploy nothing. Going public brings it all back and empties the private6# root. A flag added or removed by hand moves the pages at the repo's next7# build.8. "$(dirname "$0")/../lib.sh"9user dami10repo dami/greet "a greeter"11repo dami/other "another"12export FORGE_PAGES_DOMAIN=pages.test13clone dami dami/greet "$T/w/dami"14at "$T/w/dami" commit "first"15ok push_as dami "$T/w/dami" origin main16ok push_as dami "$T/w/dami" origin "$(site_commit "$T/w/dami" docs):refs/sites/docs"17at "$T/w/dami" git switch -q -c dami/topic18at "$T/w/dami" commit "topic"19ok push_as dami "$T/w/dami" origin dami/topic "$(site_commit "$T/w/dami" preview):refs/site-previews/docs/dami/topic"20build21w=$FORGE_WWW22p=$FORGE_ROOT/.forge/private/www23missing "$p/dami/greet"24exists "$w/dami/greet/index.html"25has "$w/index.html" 'dami/greet'26has "$w/dami/index.html" 'dami/greet'27has "$w/repos.json" '"dami/greet"'28exists "$w/sites/dami/greet/docs/index.html"29exists "$w/previews/dami/greet/docs/dami~topic/index.html"30eq "$(ls "$w/hosts" | sort | tr '\n' ' ')" "greet-docs-dami greet-docs-dami--dami-topic "3132# The mirror (a stand-in rclone, its bucket a directory) syncs right after33# the flip, though a sync has just run and the interval would hold a34# build's back, and the repo's pages leave the bucket.35fake_rclone36mkdir -p "$T/bucket/dami/greet"37echo old >"$T/bucket/dami/greet/index.html"38date +%s >"$FORGE_ROOT/.forge/mirror.last"39export FORGE_MIRROR_DELAY=0 FORGE_MIRROR_MIN_INTERVAL=360040sync_builds41ok ssh_as dami private dami/greet42has "$T_LOG" "can't be recalled"43missing "$FORGE_ROOT/dami/greet.git/git-daemon-export-ok"44missing "$w/dami/greet"45lacks "$w/index.html" 'dami/greet'46lacks "$w/dami/index.html" 'dami/greet'47lacks "$w/repos.json" 'dami/greet'48has "$w/repos.json" '"dami/other"'49missing "$w/sites/dami/greet/docs"50missing "$w/previews/dami/greet/docs/dami~topic"51eq "$(ls "$w/hosts")" ""52exists "$p/dami/greet/index.html"53exists "$p/dami/greet/code.db"54synced55exists "$T/bucket/dami/other/index.html"56missing "$T/bucket/dami/greet"57unset FORGE_MIRROR_S35859# Pushes to it now: no pages, no sites.60at "$T/w/dami" commit "more"61ok push_as dami "$T/w/dami" origin dami/topic "+$(site_commit "$T/w/dami" docs2):refs/sites/docs"62has "$T_LOG" 'site docs: not served, since dami/greet is private'63missing "$w/dami/greet"64missing "$w/sites/dami/greet/docs"65exists "$p/dami/greet/reviews/1/index.html"66has "$p/dami/greet/log/dami~topic/index.html" '>more<'67export FORGE_NO_BUILD=168build69missing "$w/dami/greet"70lacks "$w/repos.json" 'dami/greet'71ok ssh_as dami private dami/greet72has "$T_LOG" 'already private'7374sync_builds75ok ssh_as dami public dami/greet76exists "$FORGE_ROOT/dami/greet.git/git-daemon-export-ok"77exists "$w/dami/greet/index.html"78has "$w/index.html" 'dami/greet'79has "$w/repos.json" '"dami/greet"'80has "$w/sites/dami/greet/docs/index.html" 'docs2'81exists "$w/previews/dami/greet/docs/dami~topic/index.html"82eq "$(ls "$w/hosts" | sort | tr '\n' ' ')" "greet-docs-dami greet-docs-dami--dami-topic "83missing "$p/dami/greet"8485# Pages of a repo made private by hand move with the next build of it.86export FORGE_NO_BUILD=187rm "$FORGE_ROOT/dami/greet.git/git-daemon-export-ok"88build dami/greet89missing "$w/dami/greet"90lacks "$w/repos.json" 'dami/greet'91exists "$p/dami/greet/index.html"92# And back, by hand.93touch "$FORGE_ROOT/dami/greet.git/git-daemon-export-ok"94build dami/greet95exists "$w/dami/greet/index.html"96missing "$p/dami/greet"