Skip to content

Commit b76ea78

Browse files
committed
feat(server): require dependencies
closes #5
1 parent 23416ac commit b76ea78

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

bin/server.sh

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ function main {
6363
fi
6464
validate_os
6565
setup_environment
66-
ensure_dependencies
66+
require_dependencies
6767
start "$@"
6868
}
6969

@@ -107,9 +107,9 @@ function setup_environment {
107107
ensure_target_init_command
108108
}
109109

110-
function ensure_dependencies {
111-
ensure_fswatch
112-
ensure_expect
110+
function require_dependencies {
111+
require_fswatch
112+
require_expect
113113
}
114114

115115
function start_auto_survey {
@@ -277,19 +277,15 @@ function replace_line {
277277
rm -f "${file}.new"
278278
}
279279

280-
function ensure_fswatch {
280+
function require_fswatch {
281281
if ! hash fswatch 2>/dev/null; then
282-
log "fswatch is not installed. installing via brew..."
283-
# bsd/macos specific implementation
284-
brew install fswatch
282+
quit '"fswatch" is required. type `brew install fswatch` to install it, then relaunch the server.'
285283
fi
286284
}
287285

288-
function ensure_expect {
286+
function require_expect {
289287
if ! hash expect 2>/dev/null || ! hash autoexpect 2>/dev/null; then
290-
log "expect or autoexpect are not installed. installing via brew..."
291-
# bsd/macos specific implementation
292-
brew install expect
288+
quit '"expect" is required. type `brew install expect` to install it, then relaunch the server.'
293289
fi
294290
}
295291

@@ -316,7 +312,8 @@ function log {
316312
function quit {
317313
local errMsg="$1"
318314
if [[ -n "$errMsg" ]]; then
319-
log "fatal: $errMsg"
315+
log "fatal: $errMsg
316+
"
320317
else
321318
usage
322319
fi

0 commit comments

Comments
 (0)