| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 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:-?})" |