forked from fausecteam/ctf-gameserver
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
54 lines (40 loc) · 1.6 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
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 test lint 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
$(WEB_DIR)/dev-db.sqlite3: migrations $(WEB_DIR)/registration/countries.csv
$(DEV_MANAGE) migrate
$(DEV_MANAGE) createsuperuser --username admin --email ''
$(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
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)
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
rm -rf src/ctf_gameserver/web/static/ext
rm -rf build dist src/ctf_gameserver.egg-info
rm -rf docs_site