-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (63 loc) · 2.57 KB
/
Makefile
File metadata and controls
79 lines (63 loc) · 2.57 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
# Project Makefile
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
SHELL := /bin/bash
shell:
@pipenv shell "cd ${ROOT_DIR}"
init:
@pipenv install --dev
@pre-commit install
lint:
black .
isort .
build:
@docker compose -f ./docker/docker-compose.yml build
server:
@docker compose -f ./docker/docker-compose.yml up
down:
@docker compose -f ./docker/docker-compose.yml down
# deletes everything from docker except non-dangling volumes
purge-docker:
-docker stop $(shell docker ps -a -q)
-docker rm $(shell docker ps -a -q)
-docker rmi $(shell docker images -q -a)
yes | docker system prune -a
docker volume rm $(shell docker volume ls -qf dangling=true)
# deletes everything from docker including volumes
really-purge-docker:
-docker stop $(shell docker ps -a -q)
-docker rm $(shell docker ps -a -q)
-docker rmi $(shell docker images -q -a)
yes | docker system prune -a
docker volume rm $(shell docker volume ls -qf dangling=true)
docker volume rm $(shell docker volume ls -q)
models-diagram:
export SECRET_KEY=FFF && python manage.py graph_models --settings="config.settings.dev" -a --arrow-shape normal --color-code-deletions -X LogEntry,ContentType,Session,AbstractBaseSession,PermissionsMixin,AbstractBaseUser,BaseModel,Organization,Enrollment,DeviceMeasurement,VoltageDeviceMeasurement,GpsDeviceMeasurement,PickUpDeviceMeasurement,Group,Permission -g -o rezzi-portal-models-diagram.png
# TODO: standardize how you use scripts and add details to the README
# TODO: django container name to constant, or better yet fetch it in a
# reliable way
# TODO: better formatting without `bash -c`
createsuperuser:
@read -p "Enter an email for the new superuser: " EMAIL; \
read -sp "Enter a password: " PASSWORD; \
echo; \
read -sp "Confirm password: " PASSWORD_CONFIRMATION; \
echo; \
if [[ "$$PASSWORD" == "$$PASSWORD_CONFIRMATION" ]]; then \
docker exec -it docker-django-1 bash -c "python manage.py createsuperuser $$EMAIL $$PASSWORD"; \
else \
echo "Passwords do not match."; \
exit 1; \
fi
processweights:
docker exec -it docker-django-1 bash -c "python manage.py processweights"
migrate:
docker exec -it docker-django-1 bash -c "python manage.py migrate"
test:
docker exec -it docker-django-1 bash -c "python manage.py test"
makemigrations:
docker exec -it docker-django-1 bash -c "python manage.py makemigrations"
clear-migrations:
rm -f "${ROOT_DIR}/events/migrations/0001_initial.py"
rm -f "${ROOT_DIR}/fleets/migrations/0001_initial.py"
rm -f "${ROOT_DIR}/organizations/migrations/0001_initial.py"
rm -f "${ROOT_DIR}/utils/migrations/0001_initial.py"