This repository has been archived by the owner on Feb 25, 2023. It is now read-only.
/
Makefile
67 lines (52 loc) · 1.47 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
# we need this for `make man`, since we do some directory traversal
SHELL:=/bin/bash
BASH_M4=completions/kbsecret.bash.m4
BASH_M4_OUT=completions/kbsecret.bash
override CMDS+=$(shell echo lib/kbsecret/cli/kbsecret* | xargs basename -a | \
sed 's/^kbsecret-\{0,1\}//g')
M4FLAGS:=-D__KBSECRET_INTROSPECTABLE_COMMANDS="$(CMDS)"
VERSION:=$(shell git describe --tags --abbrev=0 2>/dev/null \
|| git rev-parse --short HEAD \
|| echo "unknown-version")
.PHONY: all
all: bundle completions doc man
.PHONY: bundle
bundle:
bundle check || bundle install
.PHONY: completions
completions: bash
.PHONY: doc
doc:
bundle exec yardoc
bundle exec yard stats --list-undoc
.PHONY: man-www
man-www: man
rm ../kbsecret-website/man/*.html
cp man/man{1,5}/*.html ../kbsecret-website/man/
.PHONY: man
man: ronnpp
bundle exec ronn --organization="$(VERSION)" --manual="KBSecret Manual" \
--html --roff --style toc,80c \
man/man{1,5}/*.ronn
.PHONY: ronnpp
ronnpp:
for f in man/man1/*.ronnpp; do ./man/ronnpp < $$f > man/man1/$$(basename $$f .ronnpp).ronn; done
for f in man/man5/*.ronnpp; do ./man/ronnpp < $$f > man/man5/$$(basename $$f .ronnpp).ronn; done
.PHONY: test
test: clean
bundle exec rake test
.PHONY: coverage
coverage: clean
COVERAGE=1 bundle exec rake test
.PHONY: lint
lint:
bundle exec rubocop lib/ test/
.PHONY: bash
bash:
m4 $(M4FLAGS) $(BASH_M4) > $(BASH_M4_OUT)
.PHONY: clean
clean:
rm -f $(BASH_M4_OUT)
rm -rf doc/
rm -rf man/man{1,5}/*.{html,1,5,ronn}
rm -rf coverage/