16
16
17
17
set -euo pipefail
18
18
19
- readonly SCRIPT_DIR=" $( dirname " $0 " ) "
19
+ SCRIPT_DIR=" $( dirname " $0 " ) "
20
+ readonly SCRIPT_DIR
20
21
readonly SELF_EXECUTABLE=" $0 "
21
22
readonly LOG_PREFIX=" [$0 ] "
22
23
readonly DEFAULT_POSTGRESQL_STRING=' postgresql://postgres:postgres@localhost:5432?sslmode=disable'
@@ -38,7 +39,7 @@ function parse_args {
38
39
local OPTIND=1
39
40
local OPTERR=0
40
41
while getopts " :c:p:v:hwg" arg ; do
41
- case " $arg " in
42
+ case " ${ arg} " in
42
43
c) emulator_binary=" ${OPTARG} " ;;
43
44
g) emulator_binary=" gradle" ;;
44
45
p) postgresql_string=" ${OPTARG} " ;;
@@ -59,21 +60,21 @@ function parse_args {
59
60
exit 2
60
61
;;
61
62
* )
62
- log_error_and_exit " INTERNAL ERROR: unknown argument: $arg "
63
+ log_error_and_exit " INTERNAL ERROR: unknown argument: ${ arg} "
63
64
;;
64
65
esac
65
66
done
66
67
67
- if [[ $emulator_binary != " gradle" ]] ; then
68
+ if [[ ${ emulator_binary} != " gradle" ]] ; then
68
69
export DATACONNECT_EMULATOR_BINARY_PATH=" ${emulator_binary} "
69
70
else
70
71
run_command " ${SCRIPT_DIR} /../../gradlew" -p " ${SCRIPT_DIR} /../.." --configure-on-demand :firebase-dataconnect:connectors:downloadDebugDataConnectExecutable
71
72
local gradle_emulator_binaries=(" ${SCRIPT_DIR} " /../connectors/build/intermediates/dataconnect/debug/executable/* )
72
73
if [[ ${# gradle_emulator_binaries[@]} -ne 1 ]]; then
73
74
log_error_and_exit " expected exactly 1 emulator binary from gradle, but got ${# gradle_emulator_binaries[@]} : ${gradle_emulator_binaries[*]} "
74
75
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
77
78
log_error_and_exit " emulator binary from gradle does not exist: ${gradle_emulator_binary} "
78
79
fi
79
80
export DATACONNECT_EMULATOR_BINARY_PATH=" ${gradle_emulator_binary} "
@@ -82,7 +83,7 @@ function parse_args {
82
83
export FIREBASE_DATACONNECT_POSTGRESQL_STRING=" ${postgresql_string} "
83
84
export DATA_CONNECT_PREVIEW=" ${preview_flags} "
84
85
85
- if [[ $wipe_and_restart_postgres_pod == " 1" ]] ; then
86
+ if [[ ${ wipe_and_restart_postgres_pod} == " 1" ]] ; then
86
87
run_command " ${SCRIPT_DIR} /wipe_postgres_db.sh"
87
88
run_command " ${SCRIPT_DIR} /start_postgres_pod.sh"
88
89
fi
0 commit comments