From 2b5182ac855feb5898203481aaf24450cb327903 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Jakse?= Date: Sun, 3 May 2020 13:06:52 +0200 Subject: [PATCH] Fix scripts in bin/ to work with the public folder --- .gitignore | 2 +- bin/disable-const-let.sh | 2 +- bin/setup_prod.sh | 4 +- bin/upgrade-prod.sh | 60 ++++++++++++++----- .../trivabble-server.js | 0 5 files changed, 49 insertions(+), 19 deletions(-) rename trivabble-server.js => server/trivabble-server.js (100%) diff --git a/.gitignore b/.gitignore index 3f44abf..cd8a3ea 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -/games.backup.json +/server/games.backup.json /public/config.js diff --git a/bin/disable-const-let.sh b/bin/disable-const-let.sh index 1b9b510..4aa56f2 100755 --- a/bin/disable-const-let.sh +++ b/bin/disable-const-let.sh @@ -9,7 +9,7 @@ WORKING_DIRECTORY="$(dirname "$(dirname "$0")")" if [ -d "$WORKING_DIRECTORY/.git" ]; then if [ -z "$(git status --porcelain | grep '.js$')" ]; then - sed -i -E 's/(^|\(|\s)(let|const)(\s)/\1var\3/g' "$WORKING_DIRECTORY"/*.js + sed -i -E 's/(^|\(|\s)(let|const)(\s)/\1var\3/g' "$WORKING_DIRECTORY/public"/*.js else >&2 echo "You have untracked changes in JS files. I'm not going to mess up with your working copy." exit 1 diff --git a/bin/setup_prod.sh b/bin/setup_prod.sh index c8984e3..01ec820 100755 --- a/bin/setup_prod.sh +++ b/bin/setup_prod.sh @@ -2,6 +2,6 @@ exec "$(dirname "$0")/disable-const-let.sh" -if ! [ -f "$(dirname "$(dirname "$0")")/config.js" ]; then - touch "$(dirname "$(dirname "$0")")/config.js" +if ! [ -f "$(dirname "$(dirname "$0")")/public/config.js" ]; then + touch "$(dirname "$(dirname "$0")")/public/config.js" fi diff --git a/bin/upgrade-prod.sh b/bin/upgrade-prod.sh index 79ee061..b8e60a4 100755 --- a/bin/upgrade-prod.sh +++ b/bin/upgrade-prod.sh @@ -7,22 +7,56 @@ error() { exit 1 } -if [ -z "${1+x}" ]; then - error "Please provide the production directory in parameter." -fi +help() { + cat <