forked from elbb/bb-gitversion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdobi.sh
executable file
·61 lines (53 loc) · 1.71 KB
/
dobi.sh
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
set -o errexit # abort on nonzero exitstatus
set -o pipefail # don't hide errors within pipes
# load and export env files
set -o allexport
source default.env
[[ -f local.env ]] && source local.env
set +o allexport
#check for docker
if [[ $(docker version &>/dev/null;echo $?) -ne 0 ]]; then
echo "docker is not running"
exit 1
fi
#check for dobi
dobi=".dobi/dobi"
if [[ ! -f ${dobi} ]]; then
if [[ -x $(which dobi) ]]; then
dobi=$(which dobi)
else
if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "cygwin" ]]; then
dobi_dltarget=linux
elif [[ "$OSTYPE" == "darwin"* ]]; then
dobi_dltarget=darwin
elif [[ "$OSTYPE" == "msys" || "$OSTYPE" == "win32" ]]; then
dobi_dltarget=windows
fi
if [[ ! -z ${dobi-dltarget} && -x $(which curl) ]]; then
mkdir -p .dobi
curl -L -o ${dobi} "https://github.com/dnephin/dobi/releases/download/v${DOWNLOAD_VERSION_DOBI}/dobi-${dobi_dltarget}"
if [[ ${?} -ne 0 ]]; then
echo "Download of dobi failed."
exit 1
else
chmod +x ${dobi}
fi
else
echo "\"dobi\" not found. Please install \"dobi\": https://github.com/dnephin/dobi/releases"
exit 1
fi
fi
fi
# check arguments
if [[ -z ${1} || "list" == ${@: -1} ]]; then
${dobi} --filename meta.yaml list
exit 1
fi
if [[ "version" != ${@: -1} ]]; then
VERSION_VERBOSE=0 ${dobi} --filename meta.yaml version # generate actual version files
# load generated version infos
source gen/gitversion/env/gitversion.env
fi
# execute dobi with meta as default
exec ${dobi} --filename meta.yaml ${@}