-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
58 lines (44 loc) · 1.13 KB
/
Makefile
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
default: ping-all
.PHONY: default
# Package management
# ------------------
# DOC: Update dependencies within the current virtual environment
update: _assert_venv
pip install --upgrade pip
pip install --upgrade -r requirements.txt
pip freeze
.PHONY: update
# Ansible actions
# ---------------
# DOC: Ping all servers
ping-all: _assert_venv
ansible -m ping all
.PHONY: ping-all
# Utilities
# ---------
_assert_venv:
@test -n "$${VIRTUAL_ENV}" || ( echo "This must be run in a Python virtualenv." && exit 1 )
# DOC: Show this help message
help:
@grep -A1 '^# DOC:' Makefile \
| awk ' \
BEGIN { FS="\n"; RS="--\n"; opt_len=0; } \
{ \
doc=$$1; name=$$2; \
sub("# DOC: ", "", doc); \
sub(":.*", "", name); \
if (length(name) > opt_len) { \
opt_len = length(name) \
} \
opts[NR] = name; \
docs[name] = doc; \
} \
END { \
pat="%-" (opt_len + 4) "s %s\n"; \
asort(opts); \
for (i in opts) { \
opt=opts[i]; \
printf pat, opt, docs[opt] \
} \
}'
.PHONY: help _assert_venv