2021-05-21 18:14:58 +02:00
|
|
|
# Auto-README generation
|
|
|
|
|
2024-03-07 00:33:28 +01:00
|
|
|
## Initial install
|
2021-05-21 18:14:58 +02:00
|
|
|
|
2024-03-07 00:33:28 +01:00
|
|
|
```bash
|
2021-05-21 18:14:58 +02:00
|
|
|
python3 -m venv venv
|
|
|
|
source venv/bin/activate
|
|
|
|
pip install -r requirements.txt
|
|
|
|
```
|
|
|
|
|
2024-03-07 00:33:28 +01:00
|
|
|
## Use on a single app
|
2021-05-21 18:14:58 +02:00
|
|
|
|
2024-03-07 00:33:28 +01:00
|
|
|
```bash
|
2021-05-21 18:14:58 +02:00
|
|
|
source venv/bin/activate
|
|
|
|
./make_readme.py /path/to/app
|
|
|
|
```
|
|
|
|
|
|
|
|
Then the README.md in the app folder will be updated
|
|
|
|
|
2024-03-08 05:10:47 +01:00
|
|
|
## Run tests
|
|
|
|
|
|
|
|
```bash
|
|
|
|
source venv/bin/activate
|
|
|
|
pip install pytest
|
|
|
|
pytest tests
|
|
|
|
```
|
|
|
|
|
2024-03-07 00:33:28 +01:00
|
|
|
## Launch webhook service for auto update
|
2021-05-21 18:14:58 +02:00
|
|
|
|
|
|
|
Configure the webhook on github
|
|
|
|
|
|
|
|
Also need to allow the bot to push on all repos
|
|
|
|
|
2021-05-21 20:12:00 +02:00
|
|
|
Configure nginx to reverse proxy on port 8123 (or whichever port you set in the systemd config)
|
2021-05-21 18:14:58 +02:00
|
|
|
|
|
|
|
```bash
|
|
|
|
echo "github_webhook_secret" > github_webhook_secret
|
|
|
|
echo "the_bot_login" > login
|
|
|
|
echo "the_bot_token" > token
|
|
|
|
```
|
|
|
|
|
|
|
|
Add the webhook.service to systemd config, then start it:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
systemctl start the_webhook_service
|
|
|
|
```
|
2024-03-20 05:39:03 +01:00
|
|
|
|
|
|
|
## Translation
|
|
|
|
|
|
|
|
It's based on Babel integrated into jinja2 : <https://babel.pocoo.org/en/latest/>
|
|
|
|
|
|
|
|
```bash
|
|
|
|
source venv/bin/activate
|
|
|
|
|
|
|
|
# Extract the english sentences from the code, needed if you modified it
|
|
|
|
pybabel extract --ignore-dirs venv -F babel.cfg -o messages.pot .
|
|
|
|
|
2024-03-24 05:45:21 +01:00
|
|
|
# If working on a new locale: initialize it: (in this example: fr)
|
2024-03-20 05:39:03 +01:00
|
|
|
pybabel init -i messages.pot -d translations -l fr
|
|
|
|
# Otherwise, update the existing .po:
|
|
|
|
pybabel update -i messages.pot -d translations
|
2024-03-24 05:45:21 +01:00
|
|
|
# To update only a specific language: (in this example: fr)
|
|
|
|
pybabel update -i messages.pot -d translations -l fr
|
2024-03-20 05:39:03 +01:00
|
|
|
|
|
|
|
# ... translate stuff in translations/<lang>/LC_MESSAGES/messages.po
|
|
|
|
# re-run the 'update' command to let Babel properly format the text
|
|
|
|
# then compile:
|
|
|
|
pybabel compile -d translations
|
|
|
|
```
|