-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
84 lines (60 loc) · 1.59 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
.PHONY: scripts postgres3
INTERPRETER = python3.6
VENV = venv
PYTHON = $(VENV)/bin/python
PIP = $(VENV)/bin/pip
COVERAGE = $(VENV)/bin/coverage
MANAGE = $(PYTHON) manage.py
POSTGRES_DB = fyt
POSTGRES_USER = fytuser
POSTGRES_PASSWORD = password
POSTGRES_DUMP = latest.dump
HEROKU_NAME = doc-trips
SCRIPTS = scripts/runtests
all: postgres
$(MANAGE) runserver
install: venv config.yml scripts
$(PIP) install --upgrade pip
$(PIP) install --upgrade -r requirements/dev.txt
venv:
$(INTERPRETER) -m venv $(VENV)
config.yml:
cp -nv config.yml.example config.yml
scripts:
chmod +x $(SCRIPTS)
ln -sfv $(SCRIPTS) .
migrations: postgres
$(MANAGE) makemigrations
migrate: postgres
$(MANAGE) migrate
superuser: postgres
$(MANAGE) setsuperuser d34898x
test: postgres
$(MANAGE) test --nomigrations --noinput --parallel 4
tidy:
$(VENV)/bin/importanize -v fyt
$(VENV)/bin/black -S --exclude migrations/ fyt
format:
black -S --exclude migrations/ fyt
coverage: postgres
$(COVERAGE) run --omit "$(VENV)/*" manage.py test --nomigrations
$(COVERAGE) report -m
$(COVERAGE) html
clean:
rm -rf *.pyc
rm -rf *~
rm $(POSTGRES_DUMP)
postgres:
brew services start [email protected]
#docker-compose up -d postgres
reset_db: postgres
$(MANAGE) reset_db
bootstrap: postgres
$(MANAGE) bootstrap
dump_remote:
heroku pg:backups:capture -a $(HEROKU_NAME)
heroku pg:backups:download -a $(HEROKU_NAME) --output $(POSTGRES_DUMP)
load_dump: postgres
pg_restore -v --no-acl --no-owner -n public -1 \
-h localhost -U $(POSTGRES_USER) -d $(POSTGRES_DB) $(POSTGRES_DUMP)
postgres_from_remote: dump_remote reset_db load_dump