Skip to content

Commit

Permalink
Update helpers code for proper markdown generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Salamandar committed Mar 5, 2025
1 parent 52c2c5d commit b1d7bc2
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 8 deletions.
2 changes: 0 additions & 2 deletions helpers/helpers.v1.d/mongodb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#

# Execute a mongo command
#
# example: ynh_mongo_exec --command='db.getMongo().getDBNames().indexOf("wekan")'
# example: ynh_mongo_exec --command="db.getMongo().getDBNames().indexOf(\"wekan\")"
#
Expand All @@ -33,7 +32,6 @@
# | arg: -c, --command= - The command to evaluate
# | arg: -e, --eval - Evaluate instead of execute the command.
#
#
ynh_mongo_exec() {
# Declare an array to define the options of this helper.
local legacy_args=upadhPce
Expand Down
7 changes: 5 additions & 2 deletions helpers/helpers.v2.1.d/fail2ban
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
# `../conf/f2b_jail.conf` and `../conf/f2b_filter.conf`
#
# They will typically look like (for example here for synapse):
#
# ```
# f2b_jail.conf:
# [__APP__]
Expand All @@ -39,6 +40,7 @@
# logpath = /var/log/__APP__/logfile.log
# maxretry = 5
# ```
#
# ```
# f2b_filter.conf:
# [INCLUDES]
Expand All @@ -54,16 +56,17 @@
# ignoreregex =
# ```
#
# ##### Regarding the the `failregex` option:
# ##### Regarding the the `failregex` option
#
# regex to match the password failure messages in the logfile. The host must be
# matched by a group named "`host`". The tag "`<HOST>`" can be used for standard
# IP/hostname matching and is only an alias for `(?:::f{4,6}:)?(?P<host>[\w\-.^_]+)`
#
# You can find some more explainations about how to make a regex here :
# https://www.fail2ban.org/wiki/index.php/MANUAL_0_8#Filters
# <https://www.fail2ban.org/wiki/index.php/MANUAL_0_8#Filters>
#
# To validate your regex you can test with this command:
#
# ```
# fail2ban-regex /var/log/YOUR_LOG_FILE_PATH /etc/fail2ban/filter.d/YOUR_APP.conf
# ```
Expand Down
1 change: 1 addition & 0 deletions helpers/helpers.v2.1.d/go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ _ynh_load_go_in_path_and_other_tweaks() {
#
# The helper adds the appropriate, specific version of go to the `$PATH` variable (which
# is preserved when calling `ynh_exec_as_app`). Also defines:
#
# - `$path_with_go` (the value of the modified `$PATH`, but you dont really need it?)
# - `$go_dir` (the directory containing the specific go version)
#
Expand Down
4 changes: 2 additions & 2 deletions helpers/helpers.v2.1.d/multimedia
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ ynh_multimedia_build_main_dir() {
setfacl -RL -m m::rwx "$MEDIA_DIRECTORY" || true
}

# Add a directory in yunohost.multimedia
# Add a directory in `yunohost.multimedia`
#
# usage: ynh_multimedia_addfolder --source_dir="source_dir" --dest_dir="dest_dir"
#
# | arg: --source_dir= - Source directory - The real directory which contains your medias.
# | arg: --dest_dir= - Destination directory - The name and the place of the symbolic link, relative to "/home/yunohost.multimedia"
# | arg: --dest_dir= - Destination directory - The name and the place of the symbolic link, relative to `/home/yunohost.multimedia`
#
# This "directory" will be a symbolic link to a existing directory.
ynh_multimedia_addfolder() {
Expand Down
1 change: 1 addition & 0 deletions helpers/helpers.v2.1.d/nginx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
# format and how placeholders are replaced with actual variables.
#
# Additionally, ynh_config_add_nginx will replace:
#
# - `#sub_path_only` by empty string if `path` is not `'/'`
# - `#root_path_only` by empty string if `path` *is* `'/'`
#
Expand Down
2 changes: 2 additions & 0 deletions helpers/helpers.v2.1.d/nodejs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ _ynh_load_nodejs_in_path_and_other_tweaks() {
#
# The helper adds the appropriate, specific version of nodejs to the `$PATH` variable (which
# is preserved when calling ynh_exec_as_app). Also defines:
#
# - `$path_with_nodejs` to be used in the systemd config (`Environment="PATH=__PATH_WITH_NODEJS__"`)
# - `$nodejs_dir`, the directory containing the specific version of nodejs, which may be used in the systemd config too (e.g. `ExecStart=__NODEJS_DIR__/node foo bar`)
ynh_nodejs_install() {
Expand Down Expand Up @@ -120,6 +121,7 @@ ynh_nodejs_install() {
# usage: ynh_nodejs_remove
#
# This helper will check if another app uses the same version of node.
#
# - If not, this version of node will be removed.
# - If no other app uses node, n will be also removed.
ynh_nodejs_remove() {
Expand Down
1 change: 1 addition & 0 deletions helpers/helpers.v2.1.d/ruby
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ _ynh_load_ruby_in_path_and_other_tweaks() {
#
# The helper adds the appropriate, specific version of ruby to the `$PATH` variable (which
# is preserved when calling ynh_exec_as_app). Also defines:
#
# - `$path_with_ruby` to be used in the systemd config (`Environment="PATH=__PATH_WITH_RUBY__"`)
# - `$ruby_dir`, the directory containing the specific version of ruby, which may be used in the systemd config too (e.g. `ExecStart=__RUBY_DIR__/ruby foo bar`)
#
Expand Down
2 changes: 2 additions & 0 deletions helpers/helpers.v2.1.d/sources
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
# ```
#
# You may also define assets url and checksum per-architectures such as:
#
# ```toml
# [resources.sources]
# [resources.sources.main]
Expand All @@ -71,6 +72,7 @@
# In which case `ynh_setup_source --dest_dir="$install_dir"` will automatically pick the appropriate source depending on the arch
#
# The helper will:
#
# - Download the specific URL if there is no local archive
# - Check the integrity with the specific sha256 sum
# - Uncompress the archive to `$dest_dir`.
Expand Down
3 changes: 3 additions & 0 deletions helpers/helpers.v2.1.d/systemuser
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ ynh_system_group_exists() {
# | arg: --groups - Add the user to system groups. Typically meant to add the user to the ssh.app / sftp.app group (e.g. for borgserver, my_webapp)
#
# Create a nextcloud user with no home directory and /usr/sbin/nologin login shell (hence no login capability) :
#
# ```
# ynh_system_user_create --username=nextcloud
# ```
#
# Create a discourse user using /var/www/discourse as home directory and the default login shell :
#
# ```
# ynh_system_user_create --username=discourse --home_dir=/var/www/discourse --use_shell
# ```
Expand Down
8 changes: 6 additions & 2 deletions helpers/helpers.v2.1.d/templating
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
# mode ain't enough because you need conditional blocks or loops.
#
# For a full documentation of jinja's syntax you can refer to:
# https://jinja.palletsprojects.com/en/3.1.x/templates/
# <https://jinja.palletsprojects.com/en/3.1.x/templates/>
#
# Note that in YunoHost context, all variables are from shell variables and therefore are strings
#
Expand Down Expand Up @@ -90,7 +90,7 @@ ynh_config_add() {

if [[ "$jinja" == 1 ]]; then
# This is ran in a subshell such that the "export" does not "contaminate" the main process
(
(
export $(compgen -v)
j2 "$template_path" -f env -o $destination
)
Expand Down Expand Up @@ -167,6 +167,8 @@ _ynh_replace_vars() {
# if you have several identical keys in your files
#
# Example of line this helpers can managed correctly
#
# ```text
# .yml
# title: YunoHost documentation
# email: 'yunohost@yunohost.org'
Expand All @@ -186,6 +188,8 @@ _ynh_replace_vars() {
# USER = 8102
# user = 'https://donate.local'
# CUSTOM['user'] = 'YunoHost'
# ```
#
ynh_read_var_in_file() {
# ============ Argument parsing =============
local -A args_array=([f]=file= [k]=key= [a]=after=)
Expand Down

0 comments on commit b1d7bc2

Please sign in to comment.