-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
72 lines (52 loc) · 1.78 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
69
70
71
72
SHELL = /bin/bash
MANAGE = python manage.py
define USAGE=
@echo -e
@echo -e "Usage:"
@echo -e "\tmake black [arg=--<arg>] -- black formatting"
@echo -e "\tmake flake -- run flake8"
@echo -e "\tmake celery -- start celery worker"
@echo -e "\tmake serve -- start source server"
@echo -e "\tmake serve_target -- start target server"
@echo -e "\tmake collectstatic -- run collectstatic"
@echo -e "\tmake test [arg=<test_object>] -- run all tests or specify module/class/function"
@echo -e "\tmake manage_target arg=<target_command> -- run management command on target site, arg is mandatory"
@echo -e
endef
# Argument passed from commandline, optional for some rules, mandatory for others.
arg =
# Port of target site, can be overriden by passing the parameter on the commandline.
target_port = 8001
.PHONY: black
black:
black . -l 80 --skip-string-normalization --exclude ".git|.venv|.tox|build|env|src|docs|migrations|versioneer.py" $(arg)
.PHONY: flake
flake:
flake8 .
.PHONY: celery
celery:
celery -A config worker -l info --beat
.PHONY: serve
serve:
$(MANAGE) runserver --settings=config.settings.local
.PHONY: serve_target
serve_target:
$(MANAGE) runserver 0.0.0.0:$(target_port) --settings=config.settings.local_target
.PHONY: collectstatic
collectstatic:
$(MANAGE) collectstatic --no-input
.PHONY: test
test: collectstatic
$(MANAGE) test -v 2 --parallel --settings=config.settings.test $(arg)
.PHONY: manage_target
manage_target:
ifeq ($(arg),)
@echo -e
@echo -e "ERROR:\tPlease provide \`arg=<target_command>\`"
$(USAGE)
else
$(MANAGE) $(arg) --settings=config.settings.local_target
endif
.PHONY: usage
usage:
$(USAGE)