aboutsummaryrefslogtreecommitdiff
path: root/hack/install_bats.sh
blob: 01de8b7c6dc2a7aa25b95484b5f493e9989c45ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/env bash

set -e

die() { echo "${1:-No error message given} (from $(basename $0))"; exit 1; }

if [[ "$(type -t bats)" != "" ]]; then
	# bats is already installed.
	exit 0
fi

buildDir=$(mktemp -d)
git clone https://github.com/bats-core/bats-core $buildDir

pushd $buildDir
pwd
git reset --hard ${VERSION}
echo "Installing bats to /usr/local (requires root)"
sudo ./install.sh /usr/local
popd

rm -rf $buildDir