From 12339d2b00b9f236e7e670b417d0ecd7485b878f Mon Sep 17 00:00:00 2001 From: Stanislav German-Evtushenko Date: Sat, 19 Jun 2021 02:09:20 +0900 Subject: [PATCH] gem_module: Add bindir option This option allows to specify directory to install executables, e.g. `/home/user/bin` or `/home/user/.local/bin`. This comes especially handy when used with user_install option as the default path of executables is not in PATH. --- changelogs/fragments/gem_module_add_bindir_option.yml | 2 ++ plugins/modules/packaging/language/gem.py | 11 +++++++++++ 2 files changed, 13 insertions(+) create mode 100644 changelogs/fragments/gem_module_add_bindir_option.yml diff --git a/changelogs/fragments/gem_module_add_bindir_option.yml b/changelogs/fragments/gem_module_add_bindir_option.yml new file mode 100644 index 0000000000..8bf1dc07bf --- /dev/null +++ b/changelogs/fragments/gem_module_add_bindir_option.yml @@ -0,0 +1,2 @@ +minor_changes: + - gem module - add ``bindir`` option. This option allows to specify directory to install executables, e.g. ``/home/user/bin`` or ``/home/user/.local/bin``. diff --git a/plugins/modules/packaging/language/gem.py b/plugins/modules/packaging/language/gem.py index 516c9b0a41..5358982716 100644 --- a/plugins/modules/packaging/language/gem.py +++ b/plugins/modules/packaging/language/gem.py @@ -62,6 +62,11 @@ options: These gems will be independent from the global installed ones. Specifying this requires user_install to be false. required: false + bindir: + type: path + description: + - Install executables into a specific directory. + required: false env_shebang: description: - Rewrite the shebang line on installed scripts to use /usr/bin/env. @@ -198,6 +203,9 @@ def uninstall(module): if module.params['install_dir']: cmd.extend(['--install-dir', module.params['install_dir']]) + if module.params['bindir']: + cmd.extend(['--bindir', module.params['bindir']]) + if module.params['version']: cmd.extend(['--version', module.params['version']]) else: @@ -235,6 +243,8 @@ def install(module): cmd.append('--no-user-install') if module.params['install_dir']: cmd.extend(['--install-dir', module.params['install_dir']]) + if module.params['bindir']: + cmd.extend(['--bindir', module.params['bindir']]) if module.params['pre_release']: cmd.append('--pre') if not module.params['include_doc']: @@ -265,6 +275,7 @@ def main(): state=dict(required=False, default='present', choices=['present', 'absent', 'latest'], type='str'), user_install=dict(required=False, default=True, type='bool'), install_dir=dict(required=False, type='path'), + bindir=dict(required=False, type='path'), pre_release=dict(required=False, default=False, type='bool'), include_doc=dict(required=False, default=False, type='bool'), env_shebang=dict(required=False, default=False, type='bool'),