From 7f98d29fec3ded13bed09084da7455fadbf1a0ad Mon Sep 17 00:00:00 2001 From: Alex Karle Date: Sun, 29 Mar 2020 23:31:26 -0400 Subject: [PATCH] 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! --- README.md | 4 +--- run.sh | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) create mode 100755 run.sh diff --git a/README.md b/README.md index 716343b..0afba8e 100644 --- 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 new file mode 100755 index 0000000..fd1396d --- /dev/null +++ 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 -- libgit2 1.1.1