1616
1717set -euo pipefail
1818
19- readonly SCRIPT_DIR=" $( dirname " $0 " ) "
19+ SCRIPT_DIR=" $( dirname " $0 " ) "
20+ readonly SCRIPT_DIR
2021readonly SELF_EXECUTABLE=" $0 "
2122readonly LOG_PREFIX=" [$0 ] "
2223readonly DEFAULT_POSTGRESQL_STRING=' postgresql://postgres:postgres@localhost:5432?sslmode=disable'
@@ -38,7 +39,7 @@ function parse_args {
3839 local OPTIND=1
3940 local OPTERR=0
4041 while getopts " :c:p:v:hwg" arg ; do
41- case " $arg " in
42+ case " ${ arg} " in
4243 c) emulator_binary=" ${OPTARG} " ;;
4344 g) emulator_binary=" gradle" ;;
4445 p) postgresql_string=" ${OPTARG} " ;;
@@ -59,21 +60,21 @@ function parse_args {
5960 exit 2
6061 ;;
6162 * )
62- log_error_and_exit " INTERNAL ERROR: unknown argument: $arg "
63+ log_error_and_exit " INTERNAL ERROR: unknown argument: ${ arg} "
6364 ;;
6465 esac
6566 done
6667
67- if [[ $emulator_binary != " gradle" ]] ; then
68+ if [[ ${ emulator_binary} != " gradle" ]] ; then
6869 export DATACONNECT_EMULATOR_BINARY_PATH=" ${emulator_binary} "
6970 else
7071 run_command " ${SCRIPT_DIR} /../../gradlew" -p " ${SCRIPT_DIR} /../.." --configure-on-demand :firebase-dataconnect:connectors:downloadDebugDataConnectExecutable
7172 local gradle_emulator_binaries=(" ${SCRIPT_DIR} " /../connectors/build/intermediates/dataconnect/debug/executable/* )
7273 if [[ ${# gradle_emulator_binaries[@]} -ne 1 ]]; then
7374 log_error_and_exit " expected exactly 1 emulator binary from gradle, but got ${# gradle_emulator_binaries[@]} : ${gradle_emulator_binaries[*]} "
7475 fi
75- local gradle_emulator_binary=" ${gradle_emulator_binaries[@ ]} "
76- if [[ ! -e $gradle_emulator_binary ]] ; then
76+ local gradle_emulator_binary=" ${gradle_emulator_binaries[0 ]} "
77+ if [[ ! -e ${ gradle_emulator_binary} ]] ; then
7778 log_error_and_exit " emulator binary from gradle does not exist: ${gradle_emulator_binary} "
7879 fi
7980 export DATACONNECT_EMULATOR_BINARY_PATH=" ${gradle_emulator_binary} "
@@ -82,7 +83,7 @@ function parse_args {
8283 export FIREBASE_DATACONNECT_POSTGRESQL_STRING=" ${postgresql_string} "
8384 export DATA_CONNECT_PREVIEW=" ${preview_flags} "
8485
85- if [[ $wipe_and_restart_postgres_pod == " 1" ]] ; then
86+ if [[ ${ wipe_and_restart_postgres_pod} == " 1" ]] ; then
8687 run_command " ${SCRIPT_DIR} /wipe_postgres_db.sh"
8788 run_command " ${SCRIPT_DIR} /start_postgres_pod.sh"
8889 fi
0 commit comments