Skip to content

Commit c9abdd1

Browse files
committed
feat: add infrastructure
1 parent 8270a2b commit c9abdd1

12 files changed

+205
-0
lines changed

infrastructure/deploy.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
mkdir /opt/arbitrage-scanner-bot
4+
cd /opt/ || exit
5+
git init
6+
git config core.sparseCheckout true
7+
git remote add origin https://github.com/rin-gil/arbitrage-scanner-bot
8+
echo "src" > .git/info/sparse-checkout
9+
git fetch --depth 1 origin master
10+
git checkout master
11+
rm -r -f .git
12+
mv src/* .
13+
mv src/.env.example .env
14+
rm src -r -f
15+
rm requirements-dev.txt -r -f
16+
python3 -m venv venv
17+
source venv/bin/activate
18+
pip install -r requirements.txt
19+
deactivate
20+
( cd .. && rm -f deploy.sh )
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[jinja2: **/templates/**.jinja2]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@echo off
2+
3+
cd ../..
4+
5+
call .venv\Scripts\activate
6+
7+
pybabel compile ^
8+
--directory=./src/tgbot/locales ^
9+
--statistics
10+
11+
.venv\Scripts\deactivate
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
cd ../..
4+
5+
source .venv/bin/activate
6+
7+
pybabel compile \
8+
--directory=./src/tgbot/locales \
9+
--statistics
10+
11+
deactivate
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@echo off
2+
3+
cd ../..
4+
5+
call .venv\Scripts\activate
6+
7+
pybabel extract ^
8+
-F ./infrastructure/localization/babel.cfg ^
9+
--input-dirs=./src/tgbot ^
10+
--output-file=./src/tgbot/locales/messages.pot ^
11+
--width=120 ^
12+
--sort-by-file ^
13+
--project=Telegram-Bot ^
14+
--version=1.0.0
15+
16+
.venv\Scripts\deactivate
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
cd ../..
4+
5+
source .venv/bin/activate
6+
7+
pybabel extract \
8+
-F ./infrastructure/localization/babel.cfg \
9+
--input-dirs=./src/tgbot \
10+
--output-file=./src/tgbot/locales/messages.pot \
11+
--width=120 \
12+
--sort-by-file \
13+
--project=Telegram-Bot \
14+
--version=1.0.0
15+
16+
deactivate
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@echo off
2+
3+
cd ../..
4+
5+
call .venv\Scripts\activate
6+
7+
set "all_locales=en ru"
8+
for %%L in (%all_locales%) do (
9+
pybabel init ^
10+
--input-file="./src/tgbot/locales/messages.pot" ^
11+
--output-dir="./src/tgbot/locales" ^
12+
--width=120 ^
13+
--locale="%%L"
14+
)
15+
16+
.venv\Scripts\deactivate
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
cd ../..
4+
5+
source .venv/bin/activate
6+
7+
ALL_LOCALES="en ru"
8+
9+
for LOCALE in $ALL_LOCALES; do
10+
pybabel init \
11+
--input-file=./src/tgbot/locales/messages.pot \
12+
--output-dir=./src/tgbot/locales \
13+
--width=120 \
14+
--locale="$LOCALE"
15+
done
16+
17+
deactivate
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@echo off
2+
3+
cd ../..
4+
5+
call .venv\Scripts\activate
6+
7+
set "all_locales=en ru"
8+
9+
for %%L in (%all_locales%) do (
10+
pybabel update ^
11+
--input-file=./src/tgbot/locales/messages.pot ^
12+
--output-dir=./src/tgbot/locales ^
13+
--width=120 ^
14+
--init-missing ^
15+
--update-header-comment ^
16+
--locale=%%L
17+
)
18+
19+
.venv\Scripts\deactivate
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
cd ../..
4+
5+
source venv/bin/activate
6+
7+
ALL_LOCALES="en ru"
8+
9+
for LOCALE in $ALL_LOCALES; do
10+
pybabel update \
11+
--input-file=./src/tgbot/locales/messages.pot \
12+
--output-dir=./src/tgbot/locales \
13+
--width=120 \
14+
--init-missing \
15+
--update-header-comment \
16+
--locale="$LOCALE"
17+
done
18+
19+
deactivate

0 commit comments

Comments
 (0)