1
0
Fork 0
ynh-apps_tools/readme_generator
2024-03-29 06:57:44 +01:00
..
templates adding page link about document packages 2024-03-25 07:23:59 +01:00
tests put 'testing' in 'testing branch' under codequotes 2024-03-25 07:23:59 +01:00
translations Translated readme-generator using Weblate (Galician) 2024-03-27 14:04:37 +01:00
__init__.py Rename README-generator -> readme_generator because python tools hate caps… 2024-02-15 15:03:31 +01:00
babel.cfg feat(readme_generator/i18n): add babel.cfg 2024-03-22 20:17:52 +01:00
make_readme.py 🎨 Format Python code with Black 2024-03-24 05:47:25 +01:00
messages.pot adding page link about document packages 2024-03-25 07:23:59 +01:00
nginx.conf Rename README-generator -> readme_generator because python tools hate caps… 2024-02-15 15:03:31 +01:00
README.md chores: update & fix readme templates (#2164) 2024-03-24 05:45:21 +01:00
regen_readme_in_batch.py refactor(readme-generator/regen_readme_in_batch): blep, make core more readable 2024-03-29 06:57:44 +01:00
requirements.txt fix(readme_generator): GitPython was missing from requirements.txt 2024-03-22 23:26:58 +01:00
webhook.py feat(readme_generator/webhooks): add the new ALL_README.md file to app's git repo 2024-03-22 20:17:52 +01:00
webhook.service Rename README-generator -> readme_generator because python tools hate caps… 2024-02-15 15:03:31 +01:00

Auto-README generation

Initial install

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Use on a single app

source venv/bin/activate
./make_readme.py /path/to/app

Then the README.md in the app folder will be updated

Run tests

source venv/bin/activate
pip install pytest
pytest tests

Launch webhook service for auto update

Configure the webhook on github

Also need to allow the bot to push on all repos

Configure nginx to reverse proxy on port 8123 (or whichever port you set in the systemd config)

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:

systemctl start the_webhook_service 

Translation

It's based on Babel integrated into jinja2 : https://babel.pocoo.org/en/latest/

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 .

# If working on a new locale: initialize it: (in this example: fr)
pybabel init -i messages.pot -d translations -l fr
# Otherwise, update the existing .po:
pybabel update -i messages.pot -d translations
# To update only a specific language: (in this example: fr)
pybabel update -i messages.pot -d translations -l fr

# ... 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