-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
139 lines (120 loc) · 3.57 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
PYTHON_INTERPRETER=python3
VENV_PATH=.venv
PACKAGE_NAME=django-icomoon
PACKAGE_SLUG=`echo $(PACKAGE_NAME) | tr '-' '_'`
APPLICATION_NAME=icomoon
PIP=$(VENV_PATH)/bin/pip
FLAKE=$(VENV_PATH)/bin/flake8
PYTEST=$(VENV_PATH)/bin/pytest
TWINE=$(VENV_PATH)/bin/twine
DJANGO_MANAGE=$(VENV_PATH)/bin/python sandbox/manage.py
SPHINX_RELOAD=$(VENV_PATH)/bin/python sphinx_reload.py
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo
@echo " install -- to install this project with virtualenv and Pip"
@echo
@echo " clean -- to clean EVERYTHING (Warning)"
@echo " clean-pycache -- to remove all __pycache__, this is recursive from current directory"
@echo " clean-statics -- to clean static stuff from sandbox"
@echo " clean-install -- to clean Python side installation"
@echo
@echo " run -- to run Django development server"
@echo " migrate -- to apply demo database migrations"
@echo " superuser -- to create a superuser for Django admin"
@echo " icomoon -- to deploy an icon font map on demo from an Icomoon snapshot (icomoon.zip)"
@echo
@echo " livedocs -- to run livereload server to rebuild documentation on source changes"
@echo
@echo " flake -- to launch Flake8 checking"
@echo " tests -- to launch base test suite using Pytest"
@echo " quality -- to launch Flake8 checking and every tests suites"
@echo
@echo " check-release -- to check package release before uploading it to PyPi"
@echo " release -- to release package for latest version on PyPi (once release has been pushed to repository)"
@echo
clean-pycache:
rm -Rf .pytest_cache
find . -type d -name "__pycache__"|xargs rm -Rf
find . -name "*\.pyc"|xargs rm -f
.PHONY: clean-pycache
clean-statics:
rm -Rf sandbox/static
.PHONY: clean-statics
clean-install:
rm -Rf $(VENV_PATH)
rm -Rf $(PACKAGE_SLUG).egg-info
.PHONY: clean-install
clean: clean-install clean-pycache clean-statics
.PHONY: clean
venv:
virtualenv -p $(PYTHON_INTERPRETER) $(VENV_PATH)
# This is required for those ones using old distribution
$(PIP) install --upgrade pip
$(PIP) install --upgrade setuptools
.PHONY: venv
create-var-dirs:
@mkdir -p data/db
@mkdir -p data/static/css
@mkdir -p sandbox/media
@mkdir -p sandbox/static/css
.PHONY: create-var-dirs
migrate:
@DJANGO_SECRET_KEY=$(DEMO_DJANGO_SECRET_KEY) \
$(DJANGO_MANAGE) migrate
.PHONY: migrate
superuser:
@DJANGO_SECRET_KEY=$(DEMO_DJANGO_SECRET_KEY) \
$(DJANGO_MANAGE) createsuperuser
.PHONY: superuser
install: venv create-var-dirs
$(PIP) install -e .[dev]
${MAKE} migrate
.PHONY: install
run:
@DJANGO_SECRET_KEY=$(DEMO_DJANGO_SECRET_KEY) \
$(DJANGO_MANAGE) runserver 0.0.0.0:8001
.PHONY: run
icomoon:
$(DJANGO_MANAGE) icomoon_deploy
.PHONY: icomoon
livedocs:
$(SPHINX_RELOAD)
.PHONY: livedocs
flake:
@echo
@echo "==== Flake ===="
@echo
$(FLAKE) --statistics --show-source $(APPLICATION_NAME)
$(FLAKE) --statistics --show-source tests
.PHONY: flake
tests:
@echo
@echo "==== Tests ===="
@echo
$(PYTEST) -vv tests/
.PHONY: tests
build-package:
@echo
@echo "==== Build package ===="
@echo
rm -Rf dist
$(VENV_PATH)/bin/python setup.py sdist
.PHONY: build-package
check-release: build-package
@echo
@echo "==== Check package ===="
@echo
$(TWINE) check dist/*
.PHONY: check-release
release: build-package
@echo
@echo "==== Release ===="
@echo
$(TWINE) upload dist/*
.PHONY: release
quality: tests flake check-release
@echo
@echo "♥ ♥ Everything should be fine ♥ ♥"
@echo
.PHONY: quality