-
Notifications
You must be signed in to change notification settings - Fork 21
/
Makefile
42 lines (36 loc) · 1.28 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
.PHONY: generate regenerate localmkdocs test
LATEST := v11.4.0
generate: gen/grafonnet-latest
gen/grafonnet-latest:
./scripts/generate.sh ${LATEST} && \
./scripts/generate_latest.sh ${LATEST} && \
sed -i 's/v11\..\.0/$(LATEST)/' examples/*/output.json
localmkdocs:
python -m venv .mkdocs/.venv; \
source .mkdocs/.venv/bin/activate; \
pip install -r .mkdocs/requirements.txt; \
mkdocs serve -f .mkdocs/mkdocs.yml
test:
@cd test/; \
rm -rf jsonnetfile.json vendor/; jb init; \
jb install github.com/jsonnet-libs/testonnet; \
jb install ../gen/grafonnet-${LATEST}/; \
mkdir -p $${PWD}/vendor/github.com/grafana/grafonnet/gen; \
ln -sfn $${PWD}/vendor/grafonnet-latest $${PWD}/vendor/github.com/grafana/grafonnet/gen/grafonnet-latest; \
ln -sfn $${PWD}/vendor/grafonnet-${LATEST} $${PWD}/vendor/grafonnet-latest; \
RESULT=0; \
for f in $$(find . -path './.git' -prune -o -name 'vendor' -prune -o -name '*_test.jsonnet' -print); do \
echo "$$f"; \
jsonnet -J vendor -J lib "$$f"; \
RESULT=$$(($$RESULT + $$?)); \
done; \
exit $$RESULT
fmt:
@find . \
-path './.git' -prune \
-o -path './gen' -prune \
-o -path './docs' -prune \
-o -name 'vendor' -prune \
-o -name '*.libsonnet' -print \
-o -name '*.jsonnet' -print \
| xargs -n 1 -- jsonnetfmt --no-use-implicit-plus -i