SPB Git

Repository Public

run-dev.sh 2.1 KB 30 lines shellscript

1#!/usr/bin/env bash2# Author: Simon-Pierre Boucher — contact@spboucher.ai3# File: Scripts/run-dev.sh4# Description: Launches the development variant "SP Drive Dev" against the local TEST backend and optionally captures its own window (never the screen).5#6# Usage: Scripts/run-dev.sh [--shot out.png] [--wait seconds] [--keep] [--link] [-- extra app arguments…]7#   --link    sign the app in through the device-code flow (approved by the test account with Scripts/backend-dev.sh)8#   App arguments (development variant only): -spdSection drive|recent|shared|portals|favorites|offline|downloads|transfers|conflicts|trash|storage,9#   -spdGrid YES, -spdFolder <name>, -spdPath <a/b/c>, -spdPalette YES, -spdSearch <text>, -spdSelect <name>, -spdSelectFirst YES, -spdInspector YES, -spdSheet share|versions|portal|rename|move|newFolder|conflict|ask|members|collection, -spdAsk <question>, -spdSemantic YES10set -euo pipefail11cd "$(dirname "$0")/.."12APP="$HOME/Library/Developer/SPDrive/DerivedData/Build/Products/Debug/SP Drive Dev.app"; BIN="$APP/Contents/MacOS/SP Drive Dev"13GC="$HOME/Library/Group Containers/3YM54G49SN.ai.spboucher.spdrive.dev"14SHOT=""; WAIT=5; KEEP=0; LINK=0; EXTRA=()15while [ $# -gt 0 ]; do case "$1" in --shot) SHOT="$2"; shift 2;; --wait) WAIT="$2"; shift 2;; --keep) KEEP=1; shift;; --link) LINK=1; shift;; --) shift; EXTRA=("$@"); break;; *) EXTRA+=("$1"); shift;; esac; done16stop() { local p; p="$(pgrep -f "$BIN" || true)"; [ -n "$p" ] && kill $p 2>/dev/null || true; }   # only the development copy is ever stopped17stop; sleep 0.618if [ $LINK = 1 ]; then19  rm -f "$GC/devlink.txt"20  "$BIN" -spdAutoLink -ApplePersistenceIgnoreState YES ${EXTRA[@]+"${EXTRA[@]}"} > /tmp/spdrive-dev-app.log 2>&1 &21  for _ in $(seq 1 60); do [ -f "$GC/devlink.txt" ] && break; sleep 0.25; done22  [ -f "$GC/devlink.txt" ] || { echo "the app did not produce a device code"; exit 1; }23  Scripts/backend-dev.sh approve "$(cat "$GC/devlink.txt")"24else25  "$BIN" -ApplePersistenceIgnoreState YES ${EXTRA[@]+"${EXTRA[@]}"} > /tmp/spdrive-dev-app.log 2>&1 &26fi27sleep "$WAIT"28if [ -n "$SHOT" ]; then swift Scripts/window-shot.swift "SP Drive Dev" "$SHOT" | tail -1; fi29[ $KEEP = 1 ] || stop30
Files main
Menu

Theme