crosscode: the Church App (app.sh, add, demo) and the App's changelog
scripts/products/app.sh and app.env.template.json; app in SUPPORTED_PRODUCTS; crosscode add <church> app (Accounts first); crosscode demo <church> app --profile <s>, and the App's turn, last, in a whole demo scenario. app.bats and demo.bats; app.sh linted. The full bats suite wasn't run (stopped for low memory); app.bats and demo.bats pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+43
-4
@@ -24,6 +24,11 @@ crosscode demo <church> accounts --profile <scenario> [--scenario <scenario>]
|
||||
people in Accounts (the eight scenarios, as the
|
||||
Website's profiles); a backup is taken first;
|
||||
real people and admins stay
|
||||
crosscode demo <church> app --profile <scenario> [--scenario <scenario>]
|
||||
a demo scenario's prayer wall, requests,
|
||||
announcements, devotionals and events in the App
|
||||
(App 1.0.0, the eight scenarios); a backup is taken
|
||||
first; real members stay
|
||||
crosscode demo <church> --scenario <scenario> [--admin-email <email>]
|
||||
a whole demo scenario on every product the church
|
||||
has here, Accounts first (then Events, the Website,
|
||||
@@ -115,6 +120,7 @@ DEMO_SCENARIOS="$WEBSITE_DEMO_PROFILES"
|
||||
# sites. Afterwards Events is reloaded: the demo switches campuses on or off.
|
||||
# `crosscode demo <church> website --profile <p>`: the Website's content instead (cmd_demo_website).
|
||||
# `crosscode demo <church> accounts --profile <scenario>`: a scenario's church and people (cmd_demo_accounts).
|
||||
# `crosscode demo <church> app --profile <scenario>`: the App's part of a scenario (cmd_demo_app).
|
||||
# `--scenario <s>` (agent 1.7.0): part of loading that scenario; the profile must be the scenario's.
|
||||
# `--scenario <s>` with no product and no profile (the Hub's seed-scenario job): the whole scenario
|
||||
# on every product the church has (cmd_demo_scenario).
|
||||
@@ -144,8 +150,12 @@ cmd_demo() {
|
||||
# Every product loads the profile named after the scenario (contracts DEMO_SCENARIOS).
|
||||
[ "$profile" = "$scenario" ] || die "--scenario $scenario loads the $scenario profile in $product, not $profile."
|
||||
fi
|
||||
# Agent 1.7.0 sends the App's demo jobs; the App and its demo come with App 1.0.0.
|
||||
[ "$product" != app ] || die "The Church App's demo data comes with App 1.0.0 (this crosscode has none yet)."
|
||||
if [ "$product" = app ]; then
|
||||
[[ " $DEMO_SCENARIOS " == *" $profile "* ]] || die "--profile: one of $DEMO_SCENARIOS."
|
||||
[ -z "$email" ] || die "--admin-email: the App's demo keeps every real member."
|
||||
cmd_demo_app "$church" "$profile"
|
||||
return
|
||||
fi
|
||||
if [ "$product" = accounts ]; then
|
||||
[[ " $DEMO_SCENARIOS " == *" $profile "* ]] || die "--profile: one of $DEMO_SCENARIOS."
|
||||
[ -z "$email" ] || die "--admin-email: Accounts' demo keeps every admin."
|
||||
@@ -221,8 +231,6 @@ cmd_demo_scenario() {
|
||||
step "Demo scenario $scenario: checking ${todo[*]}"
|
||||
[ "${#skipped[@]}" -eq 0 ] || info "Not installed, so skipped: ${skipped[*]}"
|
||||
for p in "${todo[@]}"; do
|
||||
# The App and its demo come with App 1.0.0 (scripts/products/app.sh).
|
||||
[ "$p" != app ] || die "The Church App's demo data comes with App 1.0.0 (this crosscode has none yet). Nothing was changed."
|
||||
# shellcheck source=/dev/null
|
||||
source "$CROSSCODE_HOME/products/$p.sh"
|
||||
v="$("${p}_expected_version" "$(pvar "$p" DIR)" 2>/dev/null || true)"
|
||||
@@ -239,6 +247,7 @@ cmd_demo_scenario() {
|
||||
accounts) cmd_demo_accounts "$church" "$scenario" ;;
|
||||
events) cmd_demo_events "$church" "$scenario" "$email" ;;
|
||||
website) cmd_demo_website "$church" "$scenario" "$scenario" ;;
|
||||
app) cmd_demo_app "$church" "$scenario" ;;
|
||||
esac
|
||||
); then
|
||||
seen=0
|
||||
@@ -283,6 +292,36 @@ cmd_demo_accounts() {
|
||||
die "Accounts didn't answer after the reload (sudo -u $user pm2 logs)."
|
||||
}
|
||||
|
||||
# The App's demo (App 1.0.0+, backend/scripts/demo.ts, APP-1.0-PLAN §12): a scenario's prayer wall,
|
||||
# requests, announcements, devotionals and events around the scenario's people (Accounts has them
|
||||
# by now), replacing the App's content and its demo members; real members stay. Every App profile is
|
||||
# a scenario, so it always loads as one. Backup first; then reloaded.
|
||||
cmd_demo_app() {
|
||||
local church="$1" profile="$2" dir user app
|
||||
require_root
|
||||
load_church "$church"
|
||||
church_has_product app || die "$church has no Church App."
|
||||
# shellcheck source=/dev/null
|
||||
source "$CROSSCODE_HOME/products/app.sh"
|
||||
dir="$(pvar app DIR)"
|
||||
user="$(pvar app USER)"
|
||||
app="$(app_app "$dir")"
|
||||
[ -f "$app/backend/scripts/demo.ts" ] || die "This release of the App ($(checkout_ref "$dir" app)) has no demo (1.0.0 or later has)."
|
||||
|
||||
step "App: backup first"
|
||||
app_backup "$dir" "$user" || die "The backup failed, so the demo wasn't loaded."
|
||||
|
||||
step "App: demo scenario ($profile)"
|
||||
run_as "$user" "$app/backend" npm run --silent demo -- --profile "$profile" --scenario "$profile" --force ||
|
||||
die "The demo wasn't loaded (see above). If it got as far as changing anything, the backup from just now has the data from before."
|
||||
|
||||
step "App: reloading PM2"
|
||||
app_reload "$dir" "$user"
|
||||
step "App: waiting for it to answer"
|
||||
wait_for_version "$(app_health_url)" "$(app_expected_version "$dir")" 60 ||
|
||||
die "The App didn't answer after the reload (sudo -u $user pm2 logs)."
|
||||
}
|
||||
|
||||
# The Website's demo (Website 1.3.0+, backend/src/demo/seeds.ts): its content replaced with one of
|
||||
# the eight demo churches, keeping the church's profile, the site settings and the admins. Backup
|
||||
# first; then reloaded, so nothing cached from before is shown.
|
||||
|
||||
Reference in New Issue
Block a user