commit 7f98d29fec3ded13bed09084da7455fadbf1a0ad (patch) parent 88c45546becc21dfdad1c33c6306ff0a9c69f47a Author: Alex Karle <alex@karle.co> Date: Sun, 29 Mar 2020 23:31:26 -0400 infra: Add small run.sh script to get going The command to run the server kept changing... wrapping it in a shell script moves the burden onto the last person to change it! Diffstat:
M | README.md | | | 4 | +--- |
A | run.sh | | | 25 | +++++++++++++++++++++++++ |
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md @@ -16,8 +16,6 @@ First, get a working Perl and cpanm. Running ------- -Run the development server as so: - ```sh -$ MOJO_INACTIVITY_TIMEOUT=500 mojo webpack ./gloat.pl +$ ./run.sh ``` diff --git a/run.sh b/run.sh @@ -0,0 +1,25 @@ +#!/bin/sh +# start the app +set -e +die() { + echo "$1" 1>&2 + exit 1 +} + +depends() { + if ! command -v "$1" >/dev/null; then + die "'$1' not found. See README.md for install instructions" + fi +} + +depends mojo + +# Need to move to top-level. Otherwise, the webpack runs a npm install +# each time the server is started... +DIR=`dirname $0` +cd $DIR + +# XXX: this should be handled by the server... +export MOJO_INACTIVITY_TIMEOUT=500 + +exec mojo webpack ./gloat.pl