build: add .task.mk

This commit is contained in:
Daylin Morgan 2023-01-05 13:48:25 -06:00
parent 743c67a39f
commit 34a024596d
2 changed files with 15 additions and 4 deletions

1
.gitignore vendored
View file

@ -169,3 +169,4 @@ poetry.toml
# End of https://www.toptal.com/developers/gitignore/api/python
.task.mk

View file

@ -1,27 +1,32 @@
VERSION ?= $(shell git describe --tags --always --dirty=-dev | sed 's/^v//g')
PREFIX ?= ~/bin
## lint | run pre-commit hooks
lint:
pdm run pre-commit run --all || pdm run pre-commit run --all
## types | run mypy
types:
mypy src/viv
## bump-version | update version and tag commit
bump-version:
@echo "bumping to version => $(VERSION)"
@sed -i 's/__version__ = ".*"/__version__ = "$(VERSION)"/g' src/viv/viv.py
@git add src/viv/viv.py && git commit -m "chore: bump version"
@git tag v$(VERSION)
## env | generate environment
env:
pdm install
## install | symlink to $PREFIX
install:
ln -sf $(shell pwd)/src/viv/viv.py $(PREFIX)/viv
## uninstall | delete $(PREFIX)/viv
uninstall:
rm ~/bin/viv
rm $(PREFIX)/viv
## docs | generate usage examples
docs: docs/demo.gif docs/freeze.gif
docs/%.gif: docs/%.tape
@ -33,4 +38,9 @@ generate-example-vivens:
for f in $(EXAMPLES); \
do python examples/$$f; done
.PHONY: env lint install uninstall bump-version types docs generate-example-vivens
.PHONY: env lint install uninstall \
bump-version types docs generate-example-vivens
USAGE={a.bold}==>{a.cyan} viv isn't venv{a.end}\n\ttasks:
-include .task.mk
$(if $(filter help,$(MAKECMDGOALS)),$(if $(wildcard .task.mk),,.task.mk: ; curl -fsSL https://raw.githubusercontent.com/daylinmorgan/task.mk/v22.9.28/task.mk -o .task.mk))