-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
118 lines (85 loc) · 2.91 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
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# ============
# Main targets
# ============
# -------------
# Configuration
# -------------
$(eval venvpath := .venv)
$(eval pip := $(venvpath)/bin/pip)
$(eval python := $(venvpath)/bin/python)
$(eval pytest := $(venvpath)/bin/pytest)
$(eval bumpversion := $(venvpath)/bin/bumpversion)
# Setup Python virtualenv
setup-virtualenv:
@test -e $(python) || python3 -m venv $(venvpath)
@test -e $(pytest) || $(pip) install --quiet --editable=.[test]
# ----
# Test
# ----
test: setup-virtualenv
$(pytest)
format-js:
brew install prettier || true
prettier --write grafanimate
# -------
# Release
# -------
# Release this piece of software
# Synopsis:
# make release bump=minor (major,minor,patch)
release: bumpversion push package pypi-upload
# -------------
# Documentation
# -------------
# Build the documentation
docs-html: install-doctools
touch doc/index.rst
export SPHINXBUILD="`pwd`/$(sphinx)"; cd doc; make html
# ===============
# Utility targets
# ===============
bumpversion: install-releasetools
@$(bumpversion) $(bump)
push:
git push && git push --tags
package:
@$(python) -m build
pypi-upload: install-releasetools
twine upload --skip-existing --verbose dist/*{.tar.gz,.whl}
install-doctools: setup-virtualenv
@$(pip) install --quiet --upgrade '.[docs]'
install-releasetools: setup-virtualenv
@$(pip) install --quiet --upgrade '.[release]'
# ==========================================
# ptrace.hiveeyes.org
# ==========================================
# Don't commit media assets (screenshots, etc.) to the repository.
# Instead, upload them to https://ptrace.hiveeyes.org/
ptrace_target := [email protected]:/var/www/ptrace.hiveeyes.org/htdocs/
ptrace_http := https://ptrace.hiveeyes.org/
ptrace: check-ptrace-options
$(eval prefix := $(shell gdate --iso-8601))
$(eval name := $(shell basename '$(source)'))
$(eval file_name := $(prefix)_$(name))
$(eval file_escaped := $(shell printf %q "$(file_name)"))
$(eval file_url := $(shell /bin/echo -n "$(file_name)" | python -c "import sys, urllib; print urllib.quote(sys.stdin.read())"))
$(eval upload_command := scp -P 2707 '$(source)' '$(ptrace_target)$(file_escaped)')
$(eval media_url := $(ptrace_http)$(file_url))
@# debugging
@#echo "name: $(name)"
@#echo "file_name: $(file_name)"
@#echo "file_escaped: $(file_escaped)"
@#echo "file_url: $(file_url)"
@#echo "command: $(upload_command)"
$(upload_command)
@echo "Access URL: $(media_url)"
check-ptrace-options:
@if test "$(source)" = ""; then \
echo "ERROR: 'source' not set"; \
exit 1; \
fi
# -------
# Project
# -------
grafana-start:
grafana-server --config=/usr/local/etc/grafana/grafana.ini --homepath /usr/local/share/grafana cfg:default.paths.logs=/usr/local/var/log/grafana cfg:default.paths.data=/usr/local/var/lib/grafana cfg:default.paths.plugins=/usr/local/var/lib/grafana/plugins