From 519566f031f264daaa1511602ef05290c96bc045 Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Thu, 1 Aug 2019 12:28:28 +0100 Subject: [PATCH] Improve development web server build task --- build | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/build b/build index cfbf883..0cb2cae 100755 --- a/build +++ b/build @@ -35,12 +35,14 @@ if [[ "$#" -lt 1 ]]; then echo -e ""; echo -e "${CSECTION}Available actions${RS}"; echo -e " ${CACTION}setup${RS} - Perform initial setup"; - echo -e " ${CACTION}render${RS} - Render the report"; echo -e " ${CACTION}server-ttn${RS} - Execute the Node.js TTN receiver."; echo -e " ${CACTION}client${RS} - Build the client-side code."; echo -e " ${CACTION}client-watch${RS} - Auto-rebuild the client-side code on modification."; - echo -e " ${CACTION}dev-server${RS} - Start the development web server for the web interface."; - echo -e " ${CACTION}dev-server-stop${RS} - Stop the development web server."; + echo -e " ${CACTION}server${RS} - Start a temporary web server for the browser-based web interface."; + echo -e " ${CACTION}server-stop${RS} - Stop a temporary web server."; + echo -e ""; + echo -e "${CSECTION}Extra development actions${RS}"; + echo -e " ${CACTION}render${RS} - Render the report"; echo -e " ${CACTION}geojson-debug${RS} - Generate some GeoJSON from the raw readings for debugging purposes (paste into geojson.io)"; echo -e ""; @@ -178,7 +180,12 @@ task_client-watch() { # ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ # ██████ ███████ ████ ███████ ███████ ██ ██ ████ ███████ ██ ██ -task_dev-server() { +task_server() { + if [ ! -f "app/index.html" ]; then + echo "No client-side code detected, running build script"; + tasks_run client; + fi + task_begin "Starting development server"; php -S "[::1]:40382" -t "app" & exit_code=$?; @@ -187,7 +194,7 @@ task_dev-server() { sleep 1; } -task_dev-server-stop() { +task_server-stop() { task_begin "Stopping development server"; if [ ! -f "/tmp/summer-project-dev-server.pid" ]; then