-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
103 lines (78 loc) · 1.79 KB
/
Copy pathMakefile
File metadata and controls
103 lines (78 loc) · 1.79 KB
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# Makefile for routine_tracker
# Variables
PACKAGE_NAME = routine_tracker
POETRY_RUN = poetry run
MANAGE = $(POETRY_RUN) python -m $(PACKAGE_NAME).manage
LOCAL_SETTINGS = local/settings.dev.py
# Default target
.PHONY: install
install: venv
$(POETRY_RUN) pre-commit install
poetry install
.PHONY: run
run:
$(MANAGE) runserver
.PHONY: test
test:
$(MANAGE) test
.PHONY: migrate
migrate:
$(MANAGE) migrate
.PHONY: migrations
migrations:
$(MANAGE) makemigrations
.PHONY: shell
shell:
$(MANAGE) shell
.PHONY: super
super:
$(MANAGE) createsuperuser
.PHONY: secretkey
secretkey:
$(MANAGE) generate_secret_key
# Create virtual environment
.PHONY: venv
venv:
test -d venv || virtualenv venv
# Create a development environment
.PHONY: devenv
devenv: venv
. venv/bin/activate; poetry install
test $(LOCAL_SETTINGS) || cp $(PACKAGE_NAME)/project/settings/templates/settings.dev.py $(LOCAL_SETTINGS)
.PHONY: lint
lint:
$(POETRY_RUN) flake8 $(PACKAGE_NAME)
.PHONY: format
format:
$(POETRY_RUN) black $(PACKAGE_NAME)
# pre-commit hooks
.PHONY: install-pre-commit
install-pre-commit: uninstall-pre-commit
$(POETRY_RUN) pre-commit install
.PHONY: uninstall-pre-commit
uninstall-pre-commit:
$(POETRY_RUN) pre-commit uninstall
.PHONY: pre-commit
pre-commit:
$(POETRY_RUN) pre-commit run --all-files
# translations
.PHONY: compile-translations
compile-translations: translations
$(MANAGE) compilelocales
.PHONY: translations
translations:
$(MANAGE) makelocales
# celery
.PHONY: celery
celery:
celery -A routine_tracker.project worker --beat --scheduler django --loglevel=info
# docker
.PHONY: docker-up-dev
up-dev:
docker-compose -f docker-compose.dev.yaml up
.PHONY: docker-build
build:
docker-compose -f docker-compose.dev.yaml build
.PHONY: docker-down
down:
docker-compose -f docker-compose.dev.yaml down