20 lines
729 B
Bash
Executable File
20 lines
729 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
|
|
if [[ $# -ne 1 || ! "$1" =~ ^(prepare|serve|stop|cleanup)$ ]]; then
|
|
printf 'usage: %s prepare|serve|stop|cleanup
|
|
' "$0" >&2
|
|
exit 2
|
|
fi
|
|
if [[ "$1" == prepare ]]; then
|
|
for command in node npm git curl unzip zipinfo lsof; do
|
|
command -v "$command" >/dev/null || { printf 'missing prerequisite: %s
|
|
' "$command" >&2; exit 127; }
|
|
done
|
|
for path in scripts/p1-acceptance.sh scripts/test-p1-acceptance.sh backend/scripts/p1-acceptance.mjs; do
|
|
[[ -f "$repo_root/$path" ]] || { printf 'Task 8 prerequisite missing: %s
|
|
' "$path" >&2; exit 1; }
|
|
done
|
|
fi
|
|
exec node "$repo_root/backend/scripts/p1-manual-acceptance.mjs" "$1"
|