-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
63 lines (53 loc) · 1.33 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
project = enum
sources = src/$(project)/*.lua
files = README.md $(sources)
tag ?=
.PHONY: release
ifndef tag
release:
$(error Fatal: must specify tag)
else
release: flake
@git status -s --untracked-files=no \
| egrep '.+' >/dev/null \
&& echo Cannot release with uncommitted files: \
&& git status -s && exit 1 \
|| true
@echo -n $(tag) > VERSION
echo -e '* Release $(tag)\n' > RELEASE
@git shortlog -n `git tag | tr \. ' ' | sort -k1.2n -k2n -k3n | tr ' ' \. | tail -1`..HEAD \
| grep -v "Restart Development" >> RELEASE
luarocks new_version --dir rockspec --tag $(tag)
@sed -i 's/@VERSION@/$(tag)/' README.md src/enum/init.lua
ldoc .
@cat RELEASE CHANGELOG > CHANGELOG.2 && mv CHANGELOG.2 CHANGELOG
git add src/enum/init.lua README.md CHANGELOG VERSION rockspec docs
git commit -F RELEASE
git tag -a $(tag) -F RELEASE
@rm -f RELEASE
@git reset HEAD~1 -- README.md src/enum/init.lua
@git commit -m "Restart Development"
@git co -- README.md src/enum/init.lua
endif
.PHONY: flake
flake:
nix flake check
.PHONY: check
check: lint test coverage
.PHONY: lint
lint:
luacheck .
.PHONY: test
test: tests/*.lua
busted .
.PHONY: coverage
coverage:
busted --coverage .
docs: $(files)
ldoc .
.PHONY: upload
upload: check
luarocks upload rockspec/$(project)-$(LUA_ENUM_VERSION).rockspec
.PHONY: clean
clean:
rm -rf luacov.*.out result