.DEFAULT_GOAL := help
help:
	@perl -nle'print $& if m{^[a-zA-Z_-]+:.*?## .*$$}' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-25s\033[0m %s\n", $$1, $$2}'

clean: clean-build clean-pyc

clean-build: ## remove build artifacts
	rm -fr build/
	rm -fr dist/
	rm -fr *.egg-info

clean-pyc: ## remove Python file artifacts
	find . -name '*.pyc' -exec rm -f {} +
	find . -name '*.pyo' -exec rm -f {} +
	find . -name '*~' -exec rm -f {} +

lint: ## check style with flake8
	flake8 .
	black --check .
	node_modules/.bin/prettier --check .

test: ## run tests quickly with the default Python
	pytest

sdist: clean ## package
	python setup.py sdist
	ls -l dist

run.migrations:
	docker-compose -f docker-compose.dev.yaml run --rm -T --no-deps web sh -c "python manage.py migrate"

run.server:
	docker-compose -f docker-compose.dev.yaml up