diff --git a/build b/build index 307745f..dbab9c6 100755 --- a/build +++ b/build @@ -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 $?; +} + + ###############################################################################