From c9a07ae4d2f13a49c61b13938a1e719ba3dc9d5e Mon Sep 17 00:00:00 2001 From: "Wyatt J. Miller" Date: Tue, 23 May 2023 17:14:53 -0400 Subject: [PATCH] added script --- hot_garb.sh | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 hot_garb.sh diff --git a/hot_garb.sh b/hot_garb.sh new file mode 100644 index 0000000..8af829b --- /dev/null +++ b/hot_garb.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# script to restart your dev env correctly +# this script is meant to be run from the root of your custom repo +# written by Wyatt J. Miller, 2023 +# copyright Wyatt J. Miller, 2023 +# licensed by the MPLv2 + +# set local variables +PRESENT_DIR=$(pwd) + +# display help +help () { + echo "Usage: cre.sh [options]" + echo "the default options are just to delete everything and start over" + echo + echo "options:" + echo "-d: purge rush and start over" + echo "-n: delete everything and start over" + echo "-h: display help" + exit 1 +} + +purge () { + cd $HOME/Source/auctionsoftware + pm2 delete all + pm2 status + rush purge && rush update && rush build && rush start + cd $PRESENT_DIR + rush purge && rush update && rush build && rush start +} + +restart () { + cd $HOME/Source/auctionsoftware + pm2 delete all + pm2 status + rush start + cd $PRESENT_DIR + rush start +} + +if [[ "$1" == -d ]] +then + purge +elif [[ "$1" == -h ]] +then + help +elif [[ "$1" == -n ]] +then + restart +else + if [[ -n "$1" ]] + then + restart + else + help + fi +fi \ No newline at end of file