-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathbuild
More file actions
executable file
·36 lines (30 loc) · 731 Bytes
/
build
File metadata and controls
executable file
·36 lines (30 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env bash
#
# Build
set -e -o pipefail
: ${PREFIX:=/usr/local}
: ${LIBDIR:="${PREFIX}/lib"}
: ${BINDIR:="${PREFIX}/bin"}
command_install() {
if [[ "${LIBDIR:0:1}" != '/' ]]; then
echo "$(basename $0): LIBDIR must be an absolute path" >&2
exit 1
fi
install -v src/bats-mock.bash "${LIBDIR}"
}
command_test() {
if [[ "${BINDIR:0:1}" != '/' ]]; then
echo "$(basename $0): BINDIR must be an absolute path" >&2
exit 1
fi
PATH="${PATH}:${BINDIR}"
bats -t test/$([[ -n "$1" ]] && echo "$1.bats")
}
main() {
if [[ "${PREFIX:0:1}" != '/' ]]; then
echo "$(basename $0): PREFIX must be an absolute path" >&2
exit 1
fi
"command_${1?'Command must be specified'}" "${@:2}"
}
main "$@"