-
Notifications
You must be signed in to change notification settings - Fork 28
/
Makefile
64 lines (47 loc) · 2.01 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
SOURCE_DIR ?= src
WEB_DIR ?= $(SOURCE_DIR)/ctf_gameserver/web
EXT_DIR ?= $(WEB_DIR)/static/ext
DEV_MANAGE ?= src/dev_manage.py
TESTS_DIR ?= tests
.PHONY: dev build ext migrations run_web test lint run_docs clean
.INTERMEDIATE: bootstrap.zip
dev: $(WEB_DIR)/dev-db.sqlite3 ext
build: ext migrations
ext: $(EXT_DIR)/jquery.min.js $(EXT_DIR)/bootstrap $(WEB_DIR)/registration/countries.csv
migrations: $(WEB_DIR)/registration/countries.csv
$(DEV_MANAGE) makemigrations templatetags registration scoring flatpages vpnstatus
$(WEB_DIR)/dev-db.sqlite3: migrations $(WEB_DIR)/registration/countries.csv
$(DEV_MANAGE) migrate
DJANGO_SUPERUSER_PASSWORD=password $(DEV_MANAGE) createsuperuser --no-input --username admin --email '[email protected]'
$(EXT_DIR)/jquery.min.js:
mkdir -p $(EXT_DIR)
curl https://code.jquery.com/jquery-1.11.3.min.js -o $@
bootstrap.zip:
curl -L https://github.com/twbs/bootstrap/releases/download/v3.3.5/bootstrap-3.3.5-dist.zip -o $@
$(EXT_DIR)/bootstrap: bootstrap.zip
mkdir -p $(EXT_DIR)
unzip -n $< -d $(EXT_DIR)
mv -v $(EXT_DIR)/bootstrap-3.3.5-dist $(EXT_DIR)/bootstrap
$(WEB_DIR)/registration/countries.csv:
# Official download link from http://data.okfn.org/data/core/country-list, under Public Domain
curl https://raw.githubusercontent.com/datasets/country-list/master/data.csv -o $@
run_web:
$(DEV_MANAGE) runserver
test:
pytest --cov $(SOURCE_DIR) $(TESTS_DIR)
lint:
# Run Pylint, pycodestyle and Bandit to check the code for potential errors, style guideline violations
# and security issues
pylint --rcfile $(SOURCE_DIR)/pylintrc $(SOURCE_DIR) $(TESTS_DIR)
pycodestyle $(SOURCE_DIR) $(TESTS_DIR)
bandit --ini bandit.ini -r $(SOURCE_DIR)
run_docs:
mkdocs serve
docs_site: mkdocs.yml $(wildcard docs/* docs/*/*)
mkdocs build --strict
clean:
rm -rf src/ctf_gameserver/web/*/migrations
rm -f src/ctf_gameserver/web/dev-db.sqlite3 src/ctf_gameserver/web/registration/countries.csv
rm -rf src/ctf_gameserver/web/static/ext
rm -rf build dist src/ctf_gameserver.egg-info
rm -rf docs_site