ifeq ($(shell test -e '.env' && echo -n yes),yes) include .env endif Manually define…
- User
ifeq ($(shell test -e '.env' && echo -n yes),yes) include .env endif
Manually define main variables
ifndef APP_PORT override APP_PORT = 8000 endif
ifndef APP_HOST override APP_HOST = 127.0.0.1 endif
parse additional args for commands
args := (MAKECMDGOALS)) ifndef args MESSAGE = "No such command (or you pass two or many targets to ). List of possible commands: make help" else MESSAGE = "Done" endif
APPLICATION_NAME = shortener TEST = poetry run python -m pytest --verbosity=2 --showlocals --log-level=DEBUG CODE = $(APPLICATION_NAME) tests
HELP_FUN =
%help; while(<>){push@{help{2//'options'}},[3]
if/^([\w-]+)\s*:.##(?:@(\w+))?\s(.)/}; \ print":\n", map" ->[0])))."_->[1]\n",\ @{help{$$}},"\n" for keys %help; \Commands
env: ##@Environment Create .env file with variables @$(eval SHELL:=/bin/bash) @cp .env.example .env
help: ##@Help Show this help @echo -e "Usage: make [target] ...\n" @perl -e '(MAKEFILE_LIST)
db: ##@Database Create database with docker-compose docker-compose -f docker-compose.yml up -d --remove-orphans
lint: ##@Code Check code with pylint poetry run python3 -m pylint $(CODE)
format: ##@Code Reformat code with isort and black poetry run python3 -m isort (CODE)
migrate: ##@Database Do all migrations in database cd (APPLICATION_NAME)/db && alembic upgrade (args)
run: ##@Application Run application server poetry run python3 -m $(APPLICATION_NAME)
revision: ##@Database Create new revision file automatically with prefix (ex. 2022_01_01_14cs34f_message.py) cd $(APPLICATION_NAME)/db && alembic revision --autogenerate
open_db: ##@Database Open database inside docker-image docker exec -it shortener_postgres psql -d (POSTGRES_USER)
test: ##@Testing Test application with pytest make db && $(TEST)
test-cov: ##@Testing Test application with pytest and create coverage report make db && (APPLICATION_NAME) --cov-report html --cov-fail-under=70
clean: ##@Code Clean directory from garbage files rm -fr *.egg-info dist
%:: echo $(MESSAGE) здесь есть ошибки?
- Assistant
No, there are no errors in this Makefile.