#!/bin/bash source .venv/bin/activate if [ -f .env ]; then source .env export REPLICATE_API_TOKEN fi case "$1" in "") mkdir -p local-data cd backend python app.py ../test-data ;; "test") # Setup test data directory mkdir -p test-data rm -f test-data/horde.db # Start backend in the background cd backend python app.py ../test-data & BACKEND_PID=$! echo "Started backend: $BACKEND_PID" sleep 2 # Run tests cd ../testing bash signup.sh #node login.js node suite.js # Finalize the backend server kill $BACKEND_PID ;; "debug") # Debug doesn't work very well... I don't use it. cd backend python app.py & cd ../frontend # This can be skipped if chrome IS installed export CHROME_EXECUTABLE=chromium export BACKEND_URL="ws://localhost:5000" flutter run -d chrome # Close backend when debugger closes kill $! ;; "watch") # requires 'inotify-tools' package cd frontend while inotifywait -r -e modify,create,delete lib; do flutter build web done ;; *) if [ -d "$1" ]; then data_dir=../$1 mkdir -p local-data cd backend python app.py $data_dir else echo "Error: unknown command or directory '$1'" fi ;; esac