OXYGENHUB
◆ main oxygenhub-android / scripts / sync-backdrop.sh
1.6 KiB · Bourne Again Shell (bash) · executable · last changed The hub's living backgrounds in the app: the mark at sign-in, Your sky on the dashboard, live runs pulse (refs #23) 8 days ago source blame history raw
1
#!/bin/sh
2
# Copy the hub's backdrop scenes into rust-core (E1 of the app's polish):
3
# the pure Rust that moves the website's living backgrounds (OxygenHub
4
# crates/backdrop: field, sky, mark, adrift, ripples, swarm, scene), with
5
# none of its browser glue, so the phone draws the very same scenes. The hub
6
# is their one source: never edit rust-core/src/backdrop by hand; change
7
# them in the hub and run this again.
8
#
9
#   scripts/sync-backdrop.sh [HUB_CHECKOUT]   (default ../oxygenhub)
10
set -eu
11
cd "$(dirname "$0")/.."
12
hub=${1:-../oxygenhub}
13
src="$hub/crates/backdrop/src"
14
[ -f "$src/sky.rs" ] || { echo "sync-backdrop: no $src/sky.rs (give the hub's checkout)" >&2; exit 1; }
15
from=$(cd "$hub" && oxy --plain log -n 1 -r "$(oxy --plain status | sed -n 's/^On \([^ ]*\) .*/\1/p')" 2>/dev/null | sed -n '1s/^[^0-9a-f]*\([0-9a-f]\{8\}\).*/\1/p')
16
out=rust-core/src/backdrop
17
mkdir -p "$out"
18
for f in field sky mark adrift ripples swarm scene; do
19
    {
20
        echo "// Copied from OxygenHub crates/backdrop/src/$f.rs (${from:-its main}) by"
21
        echo "// scripts/sync-backdrop.sh: change it there, never here."
22
        sed 's/crate::\(field\|sky\|scene\|mark\|adrift\|ripples\|swarm\)/crate::backdrop::\1/g' "$src/$f.rs"
23
    } > "$out/$f.rs"
24
done
25
cat > "$out/mod.rs" <<'MOD'
26
//! The hub's backdrop scenes (OxygenHub crates/backdrop), copied by
27
//! scripts/sync-backdrop.sh: the website's living backgrounds, stepped here
28
//! and drawn by the app (ui/backdrop).
29
#![allow(dead_code)]
30
pub mod adrift;
31
pub mod field;
32
pub mod mark;
33
pub mod ripples;
34
pub mod scene;
35
pub mod sky;
36
pub mod swarm;
37
MOD
38
echo "sync-backdrop: copied 7 scenes from $hub (${from:-?})"