-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
65 lines (52 loc) · 2.12 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
all: hooks binary
hooks:
@: ; \
gitdir=$$(git rev-parse --git-dir) ; \
if [ -d $$gitdir/hooks ] ; then \
cmp $$gitdir/../tools/pre-commit $$gitdir/hooks/pre-commit 2>/dev/null || \
echo "Updating $$gitdir/hooks/pre-commit" && cp $$gitdir/../tools/pre-commit $$gitdir/hooks/pre-commit ; \
fi
binary:
v=`git describe --always --dirty=*` ; \
t=`date +"%Y-%m-%dT%H:%M:%SZ"` ; \
go build -ldflags "-X main.GitVersion=$$v -X main.BuildTime=$$t" ./cmd/flagstate
test:
go test ./database ./util ./web
coverage:
for d in database util web ; do \
go test -coverprofile=coverage-$$d.out ./$$d && go tool cover -html=coverage-$$d.out ; \
done
reset-data:
docker-compose down || true
docker volume rm flagstate_db flagstate_registry || true
trust-local:
docker-compose exec frontend cat /etc/pki/tls/certs/flagstate_ca.crt > flagstate.crt
sudo sh -c 'cp flagstate.crt /etc/pki/ca-trust/source/anchors/ && update-ca-trust'
sudo sh -c 'grep -l registry.local.fishsoup.net /etc/hosts > /dev/null || echo "127.0.0.1 registry.local.fishsoup.net" >> /etc/hosts'
rm -f flagstate.crt
untrust-local:
sudo sh -c 'rm /etc/pki/ca-trust/source/anchors/flagstate.crt && update-ca-trust'
sudo sh -c 'sed -i /registry.local.fishsoup.net/d /etc/hosts'
MARKDOWN= \
README.md \
docs/protocol.md
docs:
@mkdir -p html ; \
for m in $(MARKDOWN) ; do \
out=html/`basename $${m%.md}`.html ; \
echo "Generating $$out" ; \
( echo '<!DOCTYPE html><html><head><link rel="stylesheet" type="text/css" href="codehilite.css"></head><body>' && \
markdown_py-3 -x codehilite -x partial_gfm -o html5 $$m && \
echo '</body>' \
) > $$out.tmp && \
mv $$out.tmp $$out || rm -f $$out.tmp ; \
done
README.html: README.md codehilite.css Makefile
( echo '<!DOCTYPE html><html><head><link rel="stylesheet" type="text/css" href="codehilite.css"></head><body>' && \
markdown_py-3 -x codehilite -x partial_gfm -o html5 $< && \
echo '</body>' \
) > [email protected] && \
mv [email protected] $@ || rm -f [email protected]
codehilite.css:
pygmentize -S default -f html > codehilite.css
.PHONY: binary test docs coverage reset-local trust-local untrust-local