57 lines
1.0 KiB
Bash
57 lines
1.0 KiB
Bash
#!/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 |