Files
hub/run.sh
T

57 lines
1.1 KiB
Bash

#!/bin/bash
source .venv/bin/activate
if [ -f .env ]; then
source .env
export REPLICATE_API_TOKEN
else
echo "No .env file found."
echo "Write a .env file with the variables: REPLICATE_API_TOKEN"
fi
case "$1" in
"")
data_dir=$(realpath ./local-data)
mkdir -p $data_dir
python backend/src/app.py $data_dir
;;
"cli")
node cli/main.js "$2"
;;
"test")
# Setup test data directory
mkdir -p test-data
rm -f test-data/horde.db
# Start backend in the background
python backend/src/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
;;
"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=$(realpath $1)
python backend/src/app.py $data_dir
else
echo "Error: unknown command or directory '$1'"
fi
;;
esac