1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/weblate_ynh.git synced 2024-10-01 13:35:04 +02:00

Merge pull request #67 from YunoHost-Apps/testing

Testing
This commit is contained in:
Kayou 2022-11-14 10:52:19 +01:00 committed by GitHub
commit d30f435fc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 88 additions and 41 deletions

View file

@ -17,8 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
Weblate is a libre web-based translation tool with tight version control integration. It provides two user interfaces, propagation of translations across components, quality checks and automatic linking to source files.
**Shipped version:** 4.14~ynh1
**Shipped version:** 4.14.2~ynh1
**Demo:** https://hosted.weblate.org/

View file

@ -17,8 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
Weblate est un outil de traduction libre avec une intégration étroite du contrôle de version. Il fournit deux interfaces utilisateur, la propagation des traductions entre les composants, les contrôles de qualité et la liaison automatique aux fichiers source.
**Version incluse :** 4.14~ynh1
**Version incluse :** 4.14.2~ynh1
**Démo :** https://hosted.weblate.org/

View file

@ -5,8 +5,9 @@
is_public=1
admin="john"
password="1Strong-Password"
github_account="myaccount"
github_token="myoauthtoken"
used_forge="GitLab"
forge_username="myusername"
forge_token="myoauthtoken"
; Checks
pkg_linter=1
setup_sub_dir=1

View file

@ -1,4 +1,4 @@
github.com:
- user: __GITHUB_ACCOUNT__
oauth_token: __GITHUB_TOKEN__
- user: __FORGE_USERNAME__
oauth_token: __FORGE_TOKEN__
protocol: https

View file

@ -229,13 +229,13 @@ TEMPLATES = [
# GitHub username and token for sending pull requests.
# Please see the documentation for more details.
GITHUB_USERNAME = "__GITHUB_ACCOUNT__"
GITHUB_TOKEN = "__GITHUB_TOKEN__"
GITHUB_USERNAME = __GITHUB_USERNAME__
GITHUB_TOKEN = __GITHUB_TOKEN__
# GitLab username and token for sending merge requests.
# Please see the documentation for more details.
GITLAB_USERNAME = None
GITLAB_TOKEN = None
GITLAB_USERNAME = __GITLAB_USERNAME__
GITLAB_TOKEN = __GITLAB_TOKEN__
# Authentication configuration
AUTHENTICATION_BACKENDS = (

View file

@ -6,7 +6,7 @@
"en": "Translation platform using Git and Python",
"fr": "Plateforme de traduction utilisant Git et Python"
},
"version": "4.14~ynh1",
"version": "4.14.2~ynh1",
"url": "https://weblate.org",
"upstream": {
"license": "AGPL-3.0",
@ -21,10 +21,12 @@
"name": "YunoHost Contributors",
"email": "apps@yunohost.org"
},
"previous_maintainers": [{
"name": "Jean-Baptiste Holcroft",
"email": "jean-baptiste@holcroft.fr"
}],
"previous_maintainers": [
{
"name": "Jean-Baptiste Holcroft",
"email": "jean-baptiste@holcroft.fr"
}
],
"requirements": {
"yunohost": ">= 4.3.0"
},
@ -58,20 +60,30 @@
"type": "password"
},
{
"name": "github_account",
"name": "used_forge",
"type": "string",
"ask": {
"en": "GitHub's username",
"fr": "Nom d'utilisateur de GitHub"
"en":"Choose the forge you use",
"fr":"Choisissez la forge que vous utilisez"
},
"example": "Github account"
"choices": ["GitHub", "GitLab"],
"default": "GitHub"
},
{
"name": "github_token",
"name": "forge_username",
"type": "string",
"ask": {
"en": "GitHub's token (OAuth)",
"fr": "Jeton GitHub (OAuth)"
"en": "Your forge's username",
"fr": "Nom d'utilisateur de votre forge"
},
"example": "Your username"
},
{
"name": "forge_token",
"type": "string",
"ask": {
"en": "Your forge's token (OAuth)",
"fr": "Jeton de votre forge (OAuth)"
},
"example": "A secret token"
}

View file

@ -31,6 +31,20 @@ fi
# PERSONAL HELPERS
#=================================================
set_forge_variables() {
if [ $used_forge = "GitHub" ] ; then
github_username="\"$forge_username\""
github_token="\"$forge_token\""
gitlab_username="None"
gitlab_token="None"
else
github_username="None"
github_token="None"
gitlab_username="\"$forge_username\""
gitlab_token="\"$forge_token\""
fi
}
#=================================================
# EXPERIMENTAL HELPERS
#=================================================

View file

@ -28,8 +28,9 @@ path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
admin=$YNH_APP_ARG_ADMIN
password=$YNH_APP_ARG_PASSWORD
github_account=$YNH_APP_ARG_GITHUB_ACCOUNT
github_token=$YNH_APP_ARG_GITHUB_TOKEN
used_forge=$YNH_APP_ARG_USED_FORGE
forge_username=$YNH_APP_ARG_FORGE_USERNAME
forge_token=$YNH_APP_ARG_FORGE_TOKEN
app=$YNH_APP_INSTANCE_NAME
@ -55,8 +56,9 @@ ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=github_account --value=$github_account
ynh_app_setting_set --app=$app --key=github_token --value=$github_token
ynh_app_setting_set --app=$app --key=used_forge --value=$used_forge
ynh_app_setting_set --app=$app --key=forge_username --value=$forge_username
ynh_app_setting_set --app=$app --key=forge_token --value=$forge_token
#=================================================
# STANDARD MODIFICATIONS
@ -128,14 +130,17 @@ ynh_secure_remove --file="$tempdir"
#=================================================
# CONFIGURE HUB
#=================================================
ynh_script_progression --message="Configure hub..." --weight=1
mkdir "$final_path/.config/"
ynh_add_config --template="../conf/hub_config" --destination="$final_path/.config/hub"
if [ $used_forge = "GitHub" ] ; then
ynh_script_progression --message="Configure hub..." --weight=1
mkdir "$final_path/.config/"
ynh_add_config --template="../conf/hub_config" --destination="$final_path/.config/hub"
cat <<EOF > "$final_path/.bashrc"
eval "$(hub alias -s /bin/bash)"
cat <<EOF > "$final_path/.bashrc"
eval "$(hub alias -s /bin/bash)"
EOF
fi
#=================================================
# PIP INSTALLATION
@ -174,6 +179,8 @@ ynh_app_setting_set --app=$app --key=redis_db --value="$redis_db"
path_url="${path_url%/}"
settings="$final_path/venv/lib/$weblate_pypath/site-packages/weblate/settings.py"
set_forge_variables
ynh_add_config --template="../conf/settings.py" --destination="$settings"
ynh_add_config --template="../conf/celery-weblate" --destination="$final_path/celery-weblate"
ynh_add_config --template="../conf/uwsgi.ini" --destination="/etc/uwsgi/apps-available/$app.ini"

View file

@ -23,8 +23,9 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
github_account=$(ynh_app_setting_get --app=$app --key=github_account)
github_token=$(ynh_app_setting_get --app=$app --key=github_token)
used_forge=$(ynh_app_setting_get --app=$app --key=used_forge)
forge_username=$(ynh_app_setting_get --app=$app --key=forge_username)
forge_token=$(ynh_app_setting_get --app=$app --key=forge_token)
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
admin_mail=$(ynh_user_get_info --username="$admin" --key=mail)
@ -33,7 +34,6 @@ key=$(ynh_string_random --length=50)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed)
@ -88,6 +88,16 @@ then
ynh_secure_remove --file="/var/log/$app-celery"
fi
# If used_forge, forge_username, forge_token don't exist, create them
if [ -z "$used_forge" ]; then
used_forge="GitHub"
forge_username=$(ynh_app_setting_get --app=$app --key=github_account)
forge_token=$(ynh_app_setting_get --app=$app --key=github_token)
ynh_app_setting_set --app=$app --key=used_forge --value=$used_forge
ynh_app_setting_set --app=$app --key=forge_username --value=$forge_username
ynh_app_setting_set --app=$app --key=forge_token --value=$forge_token
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
@ -129,14 +139,17 @@ ynh_secure_remove --file="$tempdir"
#=================================================
# CONFIGURE HUB
#=================================================
ynh_script_progression --message="Configure hub..." --weight=2
mkdir -p "$final_path/.config/"
ynh_add_config --template="../conf/hub_config" --destination="$final_path/.config/hub"
if [ $used_forge = "GitHub" ] ; then
ynh_script_progression --message="Configure hub..." --weight=1
#mkdir "$final_path/.config/"
ynh_add_config --template="../conf/hub_config" --destination="$final_path/.config/hub"
cat <<EOF > "$final_path/.bashrc"
eval "$(hub alias -s /bin/bash)"
cat <<EOF > "$final_path/.bashrc"
eval "$(hub alias -s /bin/bash)"
EOF
fi
#=================================================
# UPDATE A CONFIG FILE
@ -198,6 +211,8 @@ upgrade() {
settings="$final_path/venv/lib/$weblate_pypath/site-packages/weblate/settings.py"
path_url="${path_url%/}"
set_forge_variables
ynh_add_config --template="../conf/settings.py" --destination="$settings"
ynh_app_setting_set --app=$app --key=redis_db --value="$redis_db"