-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTaskfile
executable file
·93 lines (76 loc) · 1.8 KB
/
Taskfile
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
# Run your tasks like: run <task>
# alias run=./Taskfile
function deps {
dep ensure -update
}
function clean_flipadelphia {
local findopts=". -regextype awk -regex ".*flipadelphia$" -type f -executable -delete"
if [[ -f "$(which gfind)" ]]; then
gfind $findopts
else
find $findopts
fi
}
function clean_flippy {
local findopts=". -regextype awk -regex ".*flippy$" -type f -executable -delete"
if [[ -f "$(which gfind)" ]]; then
gfind $findopts
else
find $findopts
fi
}
function clean {
clean_flipadelphia
clean_flippy
}
function build {
clean_flipadelphia
FLIPADELPHIA_BUILD_VERSION=$(git rev-parse --verify HEAD) go build -v
}
function build_flippy {
clean_flippy
go build -v ./cmd/flippy
}
function doc {
godoc -http=:${1:-8888} -index
}
function start {
local args=$@
[[ ! -e $PWD/flipadelphia ]] && build
if [[ "$args" == "" ]]; then
[[ ! -e $HOME/.flipadelphia/config.json ]] && args="-c $PWD/config/config.example.json"
fi
./flipadelphia $args
}
function vet {
go vet
}
function install {
local bindir=${1:-${GOPATH}/bin}
build
mv ./flipadelphia $bindir
build_flippy
mv ./flippy $bindir
}
function test {
go test -v `find . -maxdepth 1 -type d -exec echo {}/... \;| egrep -v '(vendor|\.git|\.idea|\./\.|docker)'`
}
function debug {
local args=$@
if [[ "$args" == "" ]]; then
[[ ! -e $HOME/.flipadelphia/config.json ]] && args="-c $PWD/config/config.example.json"
fi
go build && dlv exec ./flipadelphia
}
function default {
start
}
function help {
echo "$0 <task> <args>"
echo "Tasks:"
compgen -A function | cat -n
}
TIMEFORMAT="Task completed in %3lR"
time ${@:-default}
# vim: set ts=2 sw=4 tw=120 ft=sh noet :