whoogle-search/run

31 lines
767 B
Plaintext
Raw Normal View History

#!/bin/sh
# Usage:
# ./run # Runs the full web app
# ./run test # Runs the testing suite
set -eu
SCRIPT_DIR="$(CDPATH= command cd -- "$(dirname -- "$0")" && pwd -P)"
# Set directory to serve static content from
2020-05-16 01:36:01 +03:00
SUBDIR="${1:-app}"
export APP_ROOT="$SCRIPT_DIR/$SUBDIR"
export STATIC_FOLDER="$APP_ROOT/static"
# Clear out build directory
rm -f "$SCRIPT_DIR"/app/static/build/*.js
rm -f "$SCRIPT_DIR"/app/static/build/*.css
# Check for regular vs test run
if [ "$SUBDIR" = "test" ]; then
# Set up static files for testing
rm -rf "$STATIC_FOLDER"
ln -s "$SCRIPT_DIR/app/static" "$STATIC_FOLDER"
pytest -sv
else
mkdir -p "$STATIC_FOLDER"
python3 -um app \
2020-05-16 01:36:01 +03:00
--host "${ADDRESS:-0.0.0.0}" \
2021-03-28 20:27:39 +03:00
--port "${PORT:-"${EXPOSE_PORT:-5000}"}"
fi