11PROJECT_NAME := $(shell basename $CURDIR)
2- VIRTUAL_ENVIRONMENT := $(CURDIR ) /.venv
3- LOCAL_PYTHON := $(VIRTUAL_ENVIRONMENT ) /bin/python3
2+ VIRTUAL_ENV := $(CURDIR ) /.venv
3+ LOCAL_PYTHON := $(VIRTUAL_ENV ) /bin/python3
44
55define HELP
66Manage $(PROJECT_NAME ) . Usage:
@@ -19,63 +19,52 @@ export HELP
1919
2020.PHONY : run install deploy update format lint clean help
2121
22- 2322all help :
2423 @echo " $$ HELP"
2524
25+ env : $(VIRTUAL_ENV )
2626
27- env : $(VIRTUAL_ENVIRONMENT )
28- 29- 30- $(VIRTUAL_ENVIRONMENT ) :
31- if [ -d $( VIRTUAL_ENVIRONMENT) ]; then \
32- @echo " Creating Python virtual environment..." && \
33- python3 -m venv $(VIRTUAL_ENVIRONMENT ) && \
27+ $(VIRTUAL_ENV ) :
28+ if [ ! -d $( VIRTUAL_ENV) ]; then \
29+ echo " Creating Python virtual env in \` ${VIRTUAL_ENV} \` " ; \
30+ python3 -m venv $(VIRTUAL_ENV ) ; \
3431 fi
3532
36- 3733.PHONY : run
3834run : env
39- $(shell python3 -m wsgi.py)
40- 35+ $(LOCAL_PYTHON ) -m main
4136
4237.PHONY : install
43- install :
44- if [ ! -d " ./.venv" ]; then python3 -m venv $( VIRTUAL_ENVIRONMENT) ; fi
45- $(shell . .venv/bin/activate)
46- $(LOCAL_PYTHON ) -m pip install --upgrade pip setuptools wheel
47- $(LOCAL_PYTHON ) -m pip install -r requirements.txt
48- 38+ install : env
39+ $(LOCAL_PYTHON ) -m pip install --upgrade pip setuptools wheel && \
40+ $(LOCAL_PYTHON ) -m pip install -r requirements.txt && \
41+ npm i -g less && \
42+ echo Installed dependencies in \` ${VIRTUAL_ENV} \` ;
4943
5044.PHONY : deploy
5145deploy :
52- make clean
53- make install
46+ make install && \
5447 make run
5548
56- 5749.PHONY : test
5850test : env
5951 $(LOCAL_PYTHON ) -m \
60- coverage run -m pytest -v \
61- --disable-pytest-warnings \
62- && coverage html --title=' Coverage Report' -d .reports \
63- && open .reports/index.html
64- 52+ coverage run -m pytest -vv \
53+ --disable-pytest-warnings && \
54+ coverage html --title=' Coverage Report' -d .reports && \
55+ open .reports/index.html
6556
6657.PHONY : update
67- update :
68- if [ ! -d " ./.venv" ]; then python3 -m venv $( VIRTUAL_ENVIRONMENT) ; fi
69- $(LOCAL_PYTHON ) -m pip install --upgrade pip setuptools wheel
70- poetry update
71- poetry export -f requirements.txt --output requirements.txt --without-hashes
72- 58+ update : env
59+ $(LOCAL_PYTHON ) -m pip install --upgrade pip setuptools wheel && \
60+ poetry update && \
61+ poetry export -f requirements.txt --output requirements.txt --without-hashes && \
62+ echo Installed dependencies in \` ${VIRTUAL_ENV} \` ;
7363
7464.PHONY : format
7565format : env
76- isort --multi-line=3 .
77- black .
78- 66+ $(LOCAL_PYTHON ) -m isort --multi-line=3 . && \
67+ $(LOCAL_PYTHON ) -m black .
7968
8069.PHONY : lint
8170lint : env
@@ -85,19 +74,20 @@ lint: env
8574 --show-source \
8675 --statistics
8776
88- 8977.PHONY : clean
9078clean :
91- find . -name ' *.pyc' -delete
92- find . -name ' __pycache__' -delete
93- find . -name ' poetry.lock' -delete
94- find . -name ' Pipefile.lock' -delete
95- find . -name ' *.log' -delete
96- find . -name ' .coverage' -delete
97- find . -wholename ' logs/*.json' -delete
98- find . -wholename ' */.pytest_cache' -delete
99- find . -wholename ' **/.pytest_cache' -delete
100- find . -wholename ' ./logs/*.json' -delete
101- find . -wholename ' .webassets-cache/*' -delete
102- find . -wholename ' ./logs' -delete
103- find . -wholename ' ./.reports' -delete
79+ find . -name ' .coverage' -delete && \
80+ find . -name ' *.pyc' -delete \
81+ find . -name ' __pycache__' -delete \
82+ find . -name ' poetry.lock' -delete \
83+ find . -name ' *.log' -delete \
84+ find . -name ' .DS_Store' -delete \
85+ find . -wholename ' **/*.pyc' -delete && \
86+ find . -wholename ' **/*.html' -delete && \
87+ find . -type d -wholename ' __pycache__' -exec rm -rf {} + && \
88+ find . -type d -wholename ' .venv' -exec rm -rf {} + && \
89+ find . -type d -wholename ' .pytest_cache' -exec rm -rf {} + && \
90+ find . -type d -wholename ' **/.pytest_cache' -exec rm -rf {} + && \
91+ find . -type d -wholename ' **/*.log' -exec rm -rf {} + && \
92+ find . -type d -wholename ' ./.reports/*' -exec rm -rf {} + && \
93+ find . -type d -wholename ' **/.webassets-cache' -exec rm -rf {} +
0 commit comments