Fancier makefile.
This commit is contained in:
parent
26a58ff6c8
commit
f76f5cec75
20
Makefile
20
Makefile
@ -9,16 +9,22 @@ IGNORE = .git .env
|
||||
PYFILES := $(filter-out $(IGNORE),$(call rwildcard,.,*.py))
|
||||
HTMLFILES := $(filter-out $(IGNORE),$(call rwildcard,.,*.html))
|
||||
|
||||
$(VENV)/touchfile: requirements.txt
|
||||
$(VENV)/.install: requirements.txt
|
||||
test -d $(VENV) || python3 -m venv $(VENV)
|
||||
$(BIN)/pip install --upgrade -r requirements.txt
|
||||
touch $(VENV)/touchfile
|
||||
touch $(VENV)/.install
|
||||
|
||||
.PHONY: migrate
|
||||
migrate: $(PYFILES) ## Make and run migrations
|
||||
$(VENV)/.migrate: $(PYFILES) $(VENV)/.install
|
||||
$(PYTHON) manage.py makemigrations
|
||||
$(PYTHON) manage.py migrate
|
||||
$(PYTHON) manage.py collectstatic --noinput
|
||||
touch $(VENV)/.migrate
|
||||
|
||||
$(VENV)/.start: $(HTMLFILES) $(VENV)/.migrate
|
||||
sudo systemctl restart gunicorn.service gunicorn.socket
|
||||
touch $(VENV)/.start
|
||||
.PHONY: migrate
|
||||
migrate: $(VENV)/.migrate ## Make and run migrations
|
||||
|
||||
.PHONY: test
|
||||
test: ## Run tests
|
||||
@ -29,11 +35,10 @@ pull:
|
||||
git pull origin master
|
||||
|
||||
.PHONY: start
|
||||
start: $(HTMLFILES) $(PYFILES) ## Restart gunicorn
|
||||
sudo systemctl restart gunicorn.service gunicorn.socket
|
||||
start: $(VENV)/.start ## Restart gunicorn
|
||||
|
||||
.PHONY: update
|
||||
update: pull $(VENV)/touchfile migrate start ## Pull latest from remote and restart
|
||||
update: pull $(VENV)/.install $(VENV)/.migrate $(VENV)/.start ## Pull latest from remote and restart
|
||||
|
||||
.PHONY: backup
|
||||
backup: ## Backup database to json file.
|
||||
@ -49,3 +54,4 @@ clean:
|
||||
|
||||
help: ## Self-documented Makefile
|
||||
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user