-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
116 lines (92 loc) · 3.48 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
SHELL = bash
# ==========================================
# environment
# ==========================================
#
# Miscellaneous tools:
# Software tests, Documentation builder, Virtual environment builder
#
docs-html: virtualenv
touch doc/source/index.rst
export SPHINXBUILD="`pwd`/.venv/bin/sphinx-build"; cd doc; make html
virtualenv:
@test -e .venv/bin/python || `command -v virtualenv` --python=`command -v python` .venv
@.venv/bin/pip --quiet install --requirement requirements.txt
# ==========================================
# html to image rasterizer
# ==========================================
# Rasterize some public Grafana dashboard snapshots
rasterize-all: rasterize-dashboard-1 rasterize-dashboard-2
rasterize-dashboard-1:
$(MAKE) rasterize \
dashboard_url=https://swarm.hiveeyes.org/grafana/dashboard/snapshot/Z9QBKYitgiOq53lrySWkbOSyWUk9rc92 \
output_image=./doc/source/_static/img/grafana-ber-prototype-1.jpeg
rasterize-dashboard-2:
$(MAKE) rasterize \
dashboard_url=https://swarm.hiveeyes.org/grafana/dashboard/snapshot/b87pjWd80DfENQXBa4JzTT5mSUt83Tsd \
output_image=./doc/source/_static/img/grafana-ber-prototype-2.jpeg
phantom_js := /opt/local/bin/phantomjs
#rasterize_js := /opt/local/share/doc/phantomjs/examples/rasterize.js
rasterize_js := ./bin/rasterize.js
#paper_format := A4
paper_format := 1024px
#zoom_factor := 0.5
rasterize:
$(phantom_js) --ignore-ssl-errors=true '$(rasterize_js)' '$(dashboard_url)' '$(output_image)' $(paper_format)
@# --debug=true
@# $(zoom_factor)
# ==========================================
# releasing
# ==========================================
#
# Release targets for convenient release cutting.
#
# Synopsis::
#
# make release bump={patch,minor,major}
#
# Setup:
#
# - Make sure you have e.g. ``bumpversion==0.5.3`` in your ``requirements.txt``
# - Add a ``.bumpversion.cfg`` to your project root properly reflecting
# the current version and the list of files to bump versions in. Example::
#
# [bumpversion]
# current_version = 0.1.0
# files = doc/source/conf.py
# commit = True
# tag = True
# tag_name = {new_version}
#
bumpversion:
.venv/bin/bumpversion $(bump)
push:
git push && git push --tags
release: virtualenv bumpversion push
# ==========================================
# 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 date --iso-8601))
$(eval name := $(shell basename '$(source)'))
$(eval file_name := $(prefix)_$(name))
$(eval file_escaped := $(shell printf %q "$(file_name)"))
$(eval file_url := $(shell echo -n "$(file_name)" | python -c "import sys, urllib; print urllib.quote(sys.stdin.read())"))
$(eval upload_command := scp '$(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 "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