-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup
executable file
·38 lines (32 loc) · 1.1 KB
/
setup
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
37
#!/bin/bash
# This script helps setup BATS framework without going through manual pains
configure_bats_assert(){
# TechDebt: Although jasonkarns/bats-assert is deprecated in
# in favor of ztombol/bats-assert, some very useful assertions
# are yet to be supported by the latter. An issue to extend support
# (https://github.com/ztombol/bats-assert/issues/20) for the
# the missing libraries posted to upstream to allow us migrate.
# Configure bats-assert library if not configured already
LIB_REPO=https://github.com/jasonkarns/bats-assert.git
LIB_DIR=tests/bats/helpers/assertions
if [[ ! -d $LIB_DIR ]]; then
git clone -b v1.1.1 $LIB_REPO $LIB_DIR
fi
}
install_bats(){
# Install BATS framework if not installed already
type bats >/dev/null 2>&1
if [[ "$?" -ne "0" ]]; then
git clone -b v0.4.0 https://github.com/sstephenson/bats.git /tmp/bats
HOST_OS=$(cat /etc/os-release | grep ^NAME)
if [[ "$HOST_OS" == *"CoreOS"* ]]; then
cd /tmp/bats && sudo ./install.sh /opt
else
cd /tmp/bats && sudo ./install.sh /usr/local
fi
cd -
rm -rf /tmp/bats
fi
}
install_bats
configure_bats_assert