forked from hackersandslackers/flask-sqlalchemy-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
58 lines (39 loc) · 1.17 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
SRCPATH := $(CURDIR)
PROJECTNAME := $(shell basename $(CURDIR))
define HELP
Manage $(PROJECTNAME). Usage:
make run - Run $(PROJECTNAME).
make deploy - Install requirements and run app for the first time.
make update - Update pip dependencies via Python Poetry.
make format - Format code with Python's `Black` library.
make clean - Remove cached files and lock files.
endef
export HELP
.PHONY: run deploy update format clean help
requirements: .requirements.txt
env: .venv/bin/activate
.requirements.txt: requirements.txt
$(shell . .venv/bin/activate && pip install -r requirements.txt)
all help:
@echo "$$HELP"
.PHONY: run
run: env
$(shell . .venv/bin/activate && flask run)
.PHONY: deploy
deploy:
$(shell . ./deploy.sh)
.PHONY: update
update: env
.venv/bin/python3 -m pip install -U pip
poetry update
poetry export -f requirements.txt --output requirements.txt --without-hashes
.PHONY: format
format: env
$(shell . .venv/bin/activate && isort ./)
$(shell . .venv/bin/activate && black ./)
.PHONY: clean
clean:
find . -name '*.pyc' -delete
find . -name '__pycache__' -delete
find . -name 'poetry.lock' -delete
find . -name 'Pipefile.lock' -delete