viv/Makefile

47 lines
1.3 KiB
Makefile
Raw Normal View History

2022-12-19 23:15:56 -06:00
VERSION ?= $(shell git describe --tags --always --dirty=-dev | sed 's/^v//g')
2022-12-20 10:21:42 -06:00
PREFIX ?= ~/bin
2023-01-05 13:48:25 -06:00
## lint | run pre-commit hooks
2022-12-19 23:11:12 -06:00
lint:
pdm run pre-commit run --all || pdm run pre-commit run --all
2023-01-05 13:48:25 -06:00
## types | run mypy
2022-12-19 23:11:12 -06:00
types:
2022-12-20 15:02:25 -06:00
mypy src/viv
2022-12-19 23:11:12 -06:00
2023-01-05 13:48:25 -06:00
## bump-version | update version and tag commit
2022-12-19 23:11:12 -06:00
bump-version:
@echo "bumping to version => $(VERSION)"
2022-12-20 14:38:17 -06:00
@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)
2022-12-19 23:11:12 -06:00
2023-01-05 13:48:25 -06:00
## env | generate environment
2022-12-19 23:11:12 -06:00
env:
pdm install
2022-12-19 23:11:12 -06:00
2023-01-05 13:48:25 -06:00
## install | symlink to $PREFIX
2022-12-19 23:11:12 -06:00
install:
ln -sf $(shell pwd)/src/viv/viv.py $(PREFIX)/viv
2022-12-19 23:11:12 -06:00
2023-01-05 13:48:25 -06:00
## uninstall | delete $(PREFIX)/viv
2022-12-19 23:11:12 -06:00
uninstall:
2023-01-05 13:48:25 -06:00
rm $(PREFIX)/viv
2022-12-19 23:11:12 -06:00
2023-01-05 13:48:25 -06:00
## docs | generate usage examples
docs: docs/demo.gif docs/freeze.gif
2022-12-20 14:29:21 -06:00
docs/%.gif: docs/%.tape
viv rm $$(viv l -q)
2022-12-20 14:29:21 -06:00
vhs < $<
EXAMPLES = cli.py sys_path.py exe_specific.py frozen_import.py named_env.py scrape.py
generate-example-vivens:
for f in $(EXAMPLES); \
do python examples/$$f; done
2023-01-05 13:48:25 -06:00
.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))