-
Notifications
You must be signed in to change notification settings - Fork 56
/
Makefile
127 lines (89 loc) · 2.95 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
include .env
tail := 200
PYTHONPATH := $(shell pwd):${PYTHONPATH}
PROJECT := aiogram_bot
LOCALES_DOMAIN := bot
LOCALES_DIR := locales
VERSION := 0.1
COPYRIGHT := Illemius
PIPENV_VERBOSITY := -1
# =================================================================================================
# Base
# =================================================================================================
default:help
help:
@echo "aiogram bot"
# =================================================================================================
# Development
# =================================================================================================
isort:
poetry run isort aiogram_bot
black:
poetry run black aiogram_bot
flake8:
poetry run flake8 aiogram_bot
lint: isort black flake8
entrypoint:
pipenv run bash ../docker-entrypoint.sh ${args}
texts-update:
poetry run pybabel extract . \
-o ${LOCALES_DIR}/${LOCALES_DOMAIN}.pot \
--project=${PROJECT} \
--version=${VERSION} \
--copyright-holder=${COPYRIGHT} \
-k __:1,2 \
--sort-by-file -w 99
poetry run pybabel update \
-d ${LOCALES_DIR} \
-D ${LOCALES_DOMAIN} \
--update-header-comment \
-i ${LOCALES_DIR}/${LOCALES_DOMAIN}.pot
texts-compile:
poetry run pybabel compile -d ${LOCALES_DIR} -D ${LOCALES_DOMAIN}
texts-create-language:
poetry run pybabel init -i ${LOCALES_DIR}/${LOCALES_DOMAIN}.pot -d ${LOCALES_DIR} -D ${LOCALES_DOMAIN} -l ${language}
alembic:
PYTHONPATH=$(shell pwd):${PYTHONPATH} poetry run alembic ${args}
migrate:
PYTHONPATH=$(shell pwd):${PYTHONPATH} poetry run alembic upgrade head
migration:
PYTHONPATH=$(shell pwd):${PYTHONPATH} poetry run alembic revision --autogenerate -m "${message}"
downgrade:
PYTHONPATH=$(shell pwd):${PYTHONPATH} poetry run alembic downgrade -1
beforeStart: docker-up-db migrate texts-compile
app:
pipenv run python -m aiogram_bot ${args}
start:
$(MAKE) beforeStart
$(MAKE) aiogram_bot args="run-polling"
# =================================================================================================
# Docker
# =================================================================================================
docker-config:
docker-compose config
docker-ps:
docker-compose ps
docker-build:
docker-compose build
docker-up-db:
docker-compose up -d redis postgres
docker-up:
docker-compose up -d --remove-orphans
docker-stop:
docker-compose stop
docker-down:
docker-compose down
docker-destroy:
docker-compose down -v --remove-orphans
docker-logs:
docker-compose logs -f --tail=${tail} ${args}
# =================================================================================================
# Application in Docker
# =================================================================================================
app-create: docker-build docker-stop docker-up
app-logs:
$(MAKE) docker-logs args="bot"
app-stop: docker-stop
app-down: docker-down
app-start: docker-stop docker-up
app-destroy: docker-destroy