forked from CodeTheChangeUBC/reBOOT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
122 lines (98 loc) · 2.33 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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
SHELL=./make-venv
export RABBITMQ_CONFIG_FILE=rabbitmq.conf
all: env static server
# List all commands
.PHONY: ls
ls:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$' | xargs
.PHONY: shell
shell:
python3 manage.py shell
.PHONY: heroku
heroku:
heroku local
.PHONY: install
install:
pip install -r requirements.txt
make migrate
make groups
make static
.PHONY: install-dev
install-dev:
pip install -r requirements-dev.txt
.PHONY: static
static:
python3 manage.py collectstatic -c --no-input
.PHONY: server
server:
python3 manage.py runserver
.PHONY: env
env:
sh scripts/start_db.sh
sh scripts/create_db.sh
ifeq ($(USER),vscode)
sudo rabbitmq-server -detached
else
rabbitmq-server -detached
endif
@echo "RabbitMQ Status: Online"
.PHONY: env-python
env-python:
python3 -m venv venv
pip install -U pip
.PHONY: stopenv
stopenv:
ifeq ($(USER),vscode)
sudo rabbitmqctl stop --idempotent
else
rabbitmqctl stop --idempotent
endif
@echo "RabbitMQ Status: Offline"
sh scripts/stop_db.sh
.PHONY: migrate
migrate:
python3 manage.py makemigrations
python3 manage.py migrate
.PHONY: celery
celery:
CELERY_TRACE_APP=1 celery --app reboot worker --without-heartbeat --without-gossip --without-mingle
.PHONY: clean
clean:
rm -rf venv
rm -rf staticfiles
.PHONY: groups
groups:
python3 manage.py creategroups
.PHONY: codespace
codespace:
find /usr/local/var/postgres -maxdepth 0 -empty -exec initdb {} \;
sudo cp ./rabbitmq-devcontainer.conf /etc/rabbitmq/rabbitmq.conf
make .env
make .git/hooks/pre-commit
make env
make env-python
make install
make install-dev
nohup bash -c 'make celery &'
.PHONY: test
test:
coverage run --source=./app ./manage.py test
.PHONY: coverage
coverage:
coverage report --sort=miss --show-missing
.PHONY: format-check
format-check:
autopep8 --diff --recursive --aggressive --aggressive --exit-code ./app ./reboot
.PHONY: format-fix
format-fix:
autopep8 --in-place --recursive --aggressive --aggressive ./app ./reboot
.PHONY: lint-check
lint-check:
ruff check --unsafe-fixes ./app ./reboot
.PHONY: lint-fix
lint-fix:
ruff check --fix --unsafe-fixes ./app ./reboot
.env:
cp .env.sample .env
.git/hooks/pre-commit:
cp hooks/pre-commit .git/hooks/pre-commit