Improve development web server build task

This commit is contained in:
Starbeamrainbowlabs 2019-08-01 12:28:28 +01:00
parent d582265ef4
commit 519566f031
1 changed files with 12 additions and 5 deletions

17
build
View File

@ -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