proper bash styling on all scripts

This commit is contained in:
Nathan Farrant-Diaz 2016-06-08 11:14:59 -04:00
parent 3614cab59d
commit 57df46c3ff
5 changed files with 32 additions and 32 deletions

View File

@ -1,4 +1,4 @@
# designed to be called from frontrunner script
script_folder=$(dirname $0)
$script_folder/check_conf_file.sh || exit 1
$script_folder/apexupdate.sh || exit 1
script_folder=$(dirname "${0}")
"${script_folder}"/check_conf_file.sh || exit 1
"${script_folder}"/apexupdate.sh || exit 1

View File

@ -3,7 +3,7 @@
# This script is designed to be run from the top level directory of your project and will break if called from anywhere else
if [ ! -e ./config/asc.conf ]; then
echo "Missing or broken symbolic link: $PWD/config/asc.conf"
echo "Missing or broken symbolic link: ${PWD}/config/asc.conf"
echo "Please use the command 'npm run switch-conf-file' to create the symbolic link ./config/asc.conf to your config file"
echo "If you don't have a config file set up you can create one using 'npm run new-config-file'"
exit 1
@ -13,24 +13,24 @@ echo "Using the config file at: $(readlink config/asc.conf)"
source ./config/asc.conf
if [ -z "$apexappid" ]; then
echo "Missing config: $apexappid apexappid"; exit 1
if [ -z "${apexappid}" ]; then
echo "Missing config: ${apexappid} apexappid"; exit 1
fi
if [ -z "$workspace_name" ]; then
echo "Missing config: $workspace_name workspace_name"; exit 1
if [ -z "${workspace_name}" ]; then
echo "Missing config: ${workspace_name} workspace_name"; exit 1
fi
if [ -z "$database_connection" ]; then
echo "Missing config: $database_connection database_connection"; exit 1
if [ -z "${database_connection}" ]; then
echo "Missing config: ${database_connection} database_connection"; exit 1
fi
if [ -z "$username" ]; then
echo "Missing config: $username username"; exit 1
if [ -z "${username}" ]; then
echo "Missing config: ${username} username"; exit 1
fi
if [ -z "$password" ]; then
echo "Missing config: $password password"; exit 1
if [ -z "${password}" ]; then
echo "Missing config: ${password} password"; exit 1
fi
echo "Config file looks good! Moving on to the next step..."

View File

@ -6,12 +6,12 @@ echo "Creating new config file..."
echo -n "Please enter the file name of your config file: "
read conf_file
if [ -z $conf_file ]; then
if [ -z "${conf_file}" ]; then
echo "Please input a value for your config file name before pressing enter"; exit 1
fi
if [ -e ./config/$conf_file ]; then
echo "Sorry, the file ./scripts/$conf_file already exists. Either delete the existing file or choose a different name and try again."; exit 1
if [ -e ./config/"${conf_file}" ]; then
echo "Sorry, the file ./scripts/${conf_file} already exists. Either delete the existing file or choose a different name and try again."; exit 1
fi
echo -n "Please enter the apexappid you would like to use. This should be chosen very carefully to avoid conflicts with other developers' app ids: "
@ -40,31 +40,31 @@ if [ ! -d ./config/ ]; then
mkdir config
fi
echo "apexappid=$apexappid" > ./config/$conf_file
echo "workspace_name=$workspace_name" >> ./config/$conf_file
echo "parsing_schema=$parsing_schema" >> ./config/$conf_file
echo "app_alias=$app_alias" >> ./config/$conf_file
echo "database_connection=$database_connection" >> ./config/$conf_file
echo "username=$username" >> ./config/$conf_file
echo "password=$password" >> ./config/$conf_file
echo "apexappid=${apexappid}" > ./config/"${conf_file}"
echo "workspace_name=${workspace_name}" >> ./config/"${conf_file}"
echo "parsing_schema=${parsing_schema}" >> ./config/"${conf_file}"
echo "app_alias=${app_alias}" >> ./config/"${conf_file}"
echo "database_connection=${database_connection}" >> ./config/"${conf_file}"
echo "username=${username}" >> ./config/"${conf_file}"
echo "password=${password}" >> ./config/"${conf_file}"
echo "Config file successfully generated! It looks like this:"
cat ./config/$conf_file
cat ./config/"${conf_file}"
echo "If anything looks wrong you can simply edit the file yourself at ./config/$conf_file"
echo "If anything looks wrong you can simply edit the file yourself at ./config/${conf_file}"
echo
echo -n "Would you like to switch to the new config file now [y/n]: "
read switch_bool
if [ $switch_bool == "y" ]; then
if [ "${switch_bool}" == "y" ]; then
cd config
if [ -h asc.conf ]; then
rm asc.conf
fi
ln -s $conf_file asc.conf
ln -s "${conf_file}" asc.conf
cd ..
echo "./config/asc.conf now points to ./config/$( readlink ./config/asc.conf )"
else

View File

@ -1,7 +1,7 @@
# designed to be called from to level project dir
if [ ! -h ./config/asc.conf ]; then
echo "Missing symbolic link: $PWD/config/asc.conf"
if [ ! -e ./config/asc.conf ]; then
echo "Missing or broken symbolic link: ${PWD}/config/asc.conf"
echo "Please use the command 'npm run switch-conf-file' to create the symbolic link ./config/asc.conf to your config file"
echo "If you don't have a config file set up you can create one using 'npm run new-config-file'"
exit 1

View File

@ -1,5 +1,5 @@
# designed to be called from frontrunner script
script_folder=$(dirname $0)
$script_folder/check_conf_file.sh || exit 1
"${script_folder}"/check_conf_file.sh || exit 1
source config/asc.conf || exit 1
sqlplus $username/$password@$database_connection @$script_folder/uninstall_apex.sql $apexappid $workspace_name $parsing_schema || exit 1
sqlplus "${username}"/"${password}"@"${database_connection}" @"${script_folder}"/uninstall_apex.sql "${apexappid}" "${workspace_name}" "${parsing_schema}" || exit 1