From e6078cbe4a5610775e8112076e6d7aa322731bf3 Mon Sep 17 00:00:00 2001 From: raydds Date: Thu, 16 Jan 2020 11:41:56 -0500 Subject: [PATCH 1/4] pipenv --py reports a big scary error on the first run. Silence stderr --- script/include/setup_functions.inc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/include/setup_functions.inc.sh b/script/include/setup_functions.inc.sh index 92c5dfa5..7f0512a7 100644 --- a/script/include/setup_functions.inc.sh +++ b/script/include/setup_functions.inc.sh @@ -22,7 +22,7 @@ check_for_existing_virtual_environment() { local target_python_version_regex="^Python ${python_version}" # Check for existing venv, and if one exists, save the Python version string - existing_venv_version=$($(pipenv --py) --version) + existing_venv_version=$($(pipenv --py 2> /dev/null) --version) if [ "$?" = "0" ]; then # Existing venv; see if the Python version matches if [[ "${existing_venv_version}" =~ ${target_python_version_regex} ]]; then From 741636f00a05d8554d3eb2c6c497dd6020eff782 Mon Sep 17 00:00:00 2001 From: raydds Date: Thu, 16 Jan 2020 11:42:12 -0500 Subject: [PATCH 2/4] This was erroring if the uploads directory already existed --- script/setup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/setup b/script/setup index 2e2dbcc6..a79c7be4 100755 --- a/script/setup +++ b/script/setup @@ -6,7 +6,7 @@ source "$(dirname "${0}")"/../script/include/global_header.inc.sh # create upload directory for app -mkdir uploads | true +mkdir -p uploads # Enable database resetting RESET_DB="true" From d595ef60d34b08004885cb6de8f83e59efa7de51 Mon Sep 17 00:00:00 2001 From: raydds Date: Thu, 16 Jan 2020 11:46:03 -0500 Subject: [PATCH 3/4] Also supress the --version error --- script/include/setup_functions.inc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/include/setup_functions.inc.sh b/script/include/setup_functions.inc.sh index 7f0512a7..97ab9e4b 100644 --- a/script/include/setup_functions.inc.sh +++ b/script/include/setup_functions.inc.sh @@ -22,7 +22,7 @@ check_for_existing_virtual_environment() { local target_python_version_regex="^Python ${python_version}" # Check for existing venv, and if one exists, save the Python version string - existing_venv_version=$($(pipenv --py 2> /dev/null) --version) + existing_venv_version=$($(pipenv --py 2> /dev/null) --version 2> /dev/null) if [ "$?" = "0" ]; then # Existing venv; see if the Python version matches if [[ "${existing_venv_version}" =~ ${target_python_version_regex} ]]; then From b059605b37ed4027980e4b27f4585c85b53b46ab Mon Sep 17 00:00:00 2001 From: raydds Date: Thu, 16 Jan 2020 11:52:18 -0500 Subject: [PATCH 4/4] Dropdb has a handy argument for conditionally dropping a database --- script/include/helper_functions.inc.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/script/include/helper_functions.inc.sh b/script/include/helper_functions.inc.sh index 0df1323a..9f5de990 100644 --- a/script/include/helper_functions.inc.sh +++ b/script/include/helper_functions.inc.sh @@ -40,9 +40,7 @@ reset_db() { local database_name="${1}" # If the DB exists, drop it - set +e - dropdb "${database_name}" - set -e + dropdb --if-exists "${database_name}" # Create a fresh DB createdb "${database_name}"