-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
68 lines (53 loc) · 1.67 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
68
.ONESHELL:
.DEFAULT_GOAL := run
TOPICS := fix - feat - docs - style - refactor - test - chore - build
PYTHON = ./.venv/bin/python3
PIP = ./.venv/bin/pip
.PHONY: run clean help commit format branch lint
help:
@echo "gmake help - display this help"
@echo "gmake branch - create a new branch"
@echo "gmake build - create and activate virtual environment"
@echo "gmake clean - remove all generated files"
@echo "gmake commit - commit changes to git"
@echo "gmake format - format the code"
@echo "gmake lint - run linters"
@echo "gmake run - run the application"
branch:
@echo "Available branch types:"
@echo "$(TOPICS)"
@read -p "Enter the branch type: " type; \
read -p "Enter the branch description (kebab-case): " description; \
git checkout -b $${type}/$${description}; \
git push --set-upstream origin $${type}/$${description}
build: venv/bin/activate
. ./.venv/bin/activate
clean:
@echo "Cleaning up..."
@find . -name "__pycache__" -type d -exec rm -rf {} +
@find . -name ".pytest_cache" -exec rm -rf {} +
@find . -name ".venv" -exec rm -rf {} +
commit: format
@echo "Available topics:"
@echo "$(TOPICS)"
@read -p "Enter the topic for the commit: " topic; \
read -p "Enter the commit message: " message; \
git add .; \
git commit -m "$${topic}: $${message}"; \
git push
format:
$(PYTHON) -m black .
lint:
$(PYTHON) -m flake8
$(PYTHON) -m pylint **/*.py **/**/*.py *.py
mongostart:
@echo "Starting MongoDB..."
brew services start [email protected]
mongostop:
@echo "Stopping MongoDB..."
brew services stop [email protected]
run: build
$(PYTHON) app.py
venv/bin/activate: requirements.txt
python3 -m venv .venv
$(PIP) install -r requirements.txt