From 6662bb3757f9a461d9caa064ebadb6ded5acf4a5 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Sun, 12 Nov 2017 22:15:09 -0500 Subject: [PATCH] found issue where config wasn't checked for test --- scripts/site_avenger/shared_site_mgr.sh | 49 +++++++++++++++---------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/scripts/site_avenger/shared_site_mgr.sh b/scripts/site_avenger/shared_site_mgr.sh index 5f3ca164..d4c5c95a 100644 --- a/scripts/site_avenger/shared_site_mgr.sh +++ b/scripts/site_avenger/shared_site_mgr.sh @@ -38,6 +38,33 @@ function check_application_dir() fi } +# tries to find an appropriate config file for the application. +function locate_config_file() +{ + local app_dirname="$1"; shift + + local configfile="$WORKDIR/config/${app_dirname}.app" +echo hoping config file would be: $configfile + if [ ! -f "$configfile" ]; then + # this is not a good config file. we can't auto-guess the config. + echo -e " +There is no specific site configuration file in: + $configfile +We will continue onward using the default and hope that this project follows +the standard pattern for cakephp projects." + # we'll pull in the default config file we set earlier; this will + # reinitialize some variables based on the app name. + else + # they gave us a valid config file. let's try using it. + export SITE_MANAGEMENT_CONFIG_FILE="$configfile" + fi + + # try to load the config. + source "$SITE_MANAGEMENT_CONFIG_FILE" + test_or_die "loading site management configuration from: $SITE_MANAGEMENT_CONFIG_FILE" + +} + # this function will seek out top-level directories in the target directory passed in. # if there is only one directory, then it is returned (in the app_dirname variable). # otherwise, the user is asked which directory to use. @@ -88,26 +115,6 @@ function find_app_folder() test_or_die "Testing application folder: $app_dirname" echo "Application folder is: $app_dirname" - - local configfile="$WORKDIR/config/${app_dirname}.app" -echo hoping config file would be: $configfile - if [ ! -f "$configfile" ]; then - # this is not a good config file. we can't auto-guess the config. - echo -e " -There is no specific site configuration file in: - $configfile -We will continue onward using the default and hope that this project follows -the standard pattern for cakephp projects." - # we'll pull in the default config file we set earlier; this will - # reinitialize some variables based on the app name. - else - # they gave us a valid config file. let's try using it. - export SITE_MANAGEMENT_CONFIG_FILE="$configfile" - fi - - # try to load the config. - source "$SITE_MANAGEMENT_CONFIG_FILE" - test_or_die "loading site management configuration from: $SITE_MANAGEMENT_CONFIG_FILE" } # ensures that the app directory name is valid. @@ -123,6 +130,8 @@ function test_app_folder() mkdir "$combo" test_or_die "Making application directory when not already present" fi + + locate_config_file "$dir" } # eases some permissions to enable apache to write log files and do other shopkeeping. -- 2.34.1