build: Add development web server build tasks

This commit is contained in:
Starbeamrainbowlabs 2019-07-22 15:47:13 +01:00
parent 80a8833c03
commit a1516a67bc

30
build
View file

@ -161,6 +161,36 @@ task_client-watch() {
} }
# ██████ ███████ ██ ██ ███████ ███████ ██████ ██ ██ ███████ ██████
# ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
# ██ ██ █████ ██ ██ █████ ███████ █████ ██████ ██ ██ █████ ██████
# ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
# ██████ ███████ ████ ███████ ███████ ██ ██ ████ ███████ ██ ██
task_dev-server() {
task_begin "Starting development server";
php -S "[::1]:40382" -t "app" &
exit_code=$?;
[[ "${exit_code}" -eq "0" ]] && echo $! >/tmp/summer-project-dev-server.pid;
task_end $?; # Should be 0 unless php died for some reason
sleep 1;
}
task_dev-server-stop() {
task_begin "Stopping development server";
if [ ! -f "/tmp/summer-project-dev-server.pid" ]; then
echo -e "${HC}${FRED}Error: The development server doesn't appear to be running, so it can't be stopped. Have you tried running ./build dev-server?${RESET}";
return 1;
fi
kill "$(cat /tmp/summer-project-dev-server.pid)";
rm /tmp/summer-project-dev-server.pid;
task_end $?;
}
############################################################################### ###############################################################################