2017-11-18 19:11:14 +01:00
|
|
|
#!/bin/bash
|
2017-11-12 16:27:10 +01:00
|
|
|
set -e
|
2017-11-12 16:15:12 +01:00
|
|
|
|
2017-11-18 19:11:14 +01:00
|
|
|
if tty -s; then
|
2017-11-18 17:02:43 +01:00
|
|
|
bold=$(tput bold)
|
|
|
|
normal=$(tput sgr0)
|
|
|
|
else
|
|
|
|
bold=""
|
|
|
|
normal=""
|
|
|
|
fi
|
2017-11-12 16:15:12 +01:00
|
|
|
|
|
|
|
step() {
|
|
|
|
echo "${bold}$1${normal}"
|
|
|
|
}
|
|
|
|
|
2017-11-19 12:32:25 +01:00
|
|
|
if ! type go >/dev/null; then
|
2017-11-18 19:11:14 +01:00
|
|
|
step "go binary not installed or not in \$PATH" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-11-12 16:15:12 +01:00
|
|
|
if [ -z "$GOPATH" ]; then
|
|
|
|
step "Make sure you have your GOPATH configured correctly" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
CHECKOUTPATH="${GOPATH}/src/github.com/zrepl/zrepl"
|
2017-11-18 19:11:14 +01:00
|
|
|
|
|
|
|
builddep() {
|
|
|
|
step "Install build depdencies using 'go get' to \$GOPATH/bin"
|
|
|
|
go get -u golang.org/x/tools/cmd/stringer
|
|
|
|
go get -u github.com/golang/dep/cmd/dep
|
|
|
|
if ! type stringer || ! type dep; then
|
|
|
|
echo "Installed dependencies but can't find them in \$PATH, adjust it to contain \$GOPATH/bin" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
godep() {
|
|
|
|
step "Fetching dependencies using 'dep ensure'"
|
|
|
|
dep ensure
|
|
|
|
}
|
|
|
|
|
|
|
|
docdep() {
|
|
|
|
if ! type pip3; then
|
|
|
|
step "pip3 binary not installed or not in \$PATH" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
step "Installing doc build dependencies"
|
|
|
|
local reqpath="${CHECKOUTPATH}/docs/requirements.txt"
|
|
|
|
if [ ! -z "$ZREPL_LAZY_DOCS_REQPATH" ]; then
|
|
|
|
reqpath="$ZREPL_LAZY_DOCS_REQPATH"
|
|
|
|
fi
|
|
|
|
pip3 install -r "$reqpath"
|
|
|
|
}
|
|
|
|
|
|
|
|
release() {
|
|
|
|
step "Making release"
|
|
|
|
make release
|
|
|
|
}
|
2017-11-12 16:15:12 +01:00
|
|
|
|
2017-11-18 19:11:14 +01:00
|
|
|
for cmd in "$@"; do
|
|
|
|
case "$cmd" in
|
2017-11-19 12:32:25 +01:00
|
|
|
builddep|godep|docdep|release_bins|docs)
|
|
|
|
eval $cmd
|
2017-11-18 19:11:14 +01:00
|
|
|
continue
|
|
|
|
;;
|
|
|
|
devsetup)
|
|
|
|
step "Installing development dependencies"
|
|
|
|
builddep
|
|
|
|
docdep
|
|
|
|
step "Development dependencies installed"
|
|
|
|
continue
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
step "Invalid command ${cmd}, exiting"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
2017-11-12 16:15:12 +01:00
|
|
|
|