mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-08 14:20:04 -07:00
gem_module: Add bindir option (#2837)
* 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. * Update changelogs/fragments/gem_module_add_bindir_option.yml Co-authored-by: Ajpantuso <ajpantuso@gmail.com> * gem_module: Integration tests for bindir option * gem_module: Update Integration tests for bindir option * gem_module: Update Integration tests for bindir option Make sure gist is not installed system-wide prior the tests * Revert "gem_module: Update Integration tests for bindir option" This reverts commit04eec6db27
. * Do not check "install_gem_result is changed" for ansible develop on openSUSE * Revert "Do not check "install_gem_result is changed" for ansible develop on openSUSE" This reverts commit48ecb27889
. * gem_module: Use --norc to avoid surprises Run install and uninstall actions with `--norc`. This way ansible has more control over the way gems are installed. * Revert "gem_module: Use --norc to avoid surprises" This reverts commit66f40bcfe6
. * gem_module: bindir - Ignore openSUSE Leap * Update plugins/modules/packaging/language/gem.py Co-authored-by: Felix Fontein <felix@fontein.de> * gem_module: Use --norc to avoid surprises Run install and uninstall actions with `--norc` when supported (rubygems >= 2.5.2). This way ansible has more control over the way gems are installed. * Try distutils.version instead of packaging * ver is an list, not string * ver is not list either but tuple * Update changelogs/fragments/gem_module_add_bindir_option.yml Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> * ver can be None (when can this happen?) * gem: Add norc option * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/packaging/language/gem.py Co-authored-by: Felix Fontein <felix@fontein.de> * Use tuples to compare versions * Apply suggestions from code review Co-authored-by: Amin Vakil <info@aminvakil.com> * Update plugins/modules/packaging/language/gem.py Co-authored-by: Amin Vakil <info@aminvakil.com> * lost norc option check is back * Move handling norc option to separate function * cosmetic * fix for the previos commit * Apply suggestions from code review Co-authored-by: Felix Fontein <felix@fontein.de> * Cache result of get_rubygems_version Co-authored-by: Ajpantuso <ajpantuso@gmail.com> Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> Co-authored-by: Amin Vakil <info@aminvakil.com>
This commit is contained in:
parent
519411e026
commit
ce35d88094
3 changed files with 84 additions and 7 deletions
|
@ -178,3 +178,44 @@
|
|||
that:
|
||||
- install_gem_result is changed
|
||||
- gem_search.files | length == 0
|
||||
|
||||
# Custom directory for executables (--bindir)
|
||||
- name: Install gem with custom bindir
|
||||
gem:
|
||||
name: gist
|
||||
state: present
|
||||
bindir: "{{ output_dir }}/custom_bindir"
|
||||
norc: yes
|
||||
user_install: no # Avoid conflicts between --install-dir and --user-install when running as root on CentOS / Fedora / RHEL
|
||||
register: install_gem_result
|
||||
|
||||
- name: Get stats of gem executable
|
||||
stat:
|
||||
path: "{{ output_dir }}/custom_bindir/gist"
|
||||
register: gem_bindir_stat
|
||||
|
||||
- name: Ensure gem executable was installed in custom directory
|
||||
assert:
|
||||
that:
|
||||
- install_gem_result is changed
|
||||
- gem_bindir_stat.stat.exists and gem_bindir_stat.stat.isreg
|
||||
|
||||
- name: Remove gem with custom bindir
|
||||
gem:
|
||||
name: gist
|
||||
state: absent
|
||||
bindir: "{{ output_dir }}/custom_bindir"
|
||||
norc: yes
|
||||
user_install: no # Avoid conflicts between --install-dir and --user-install when running as root on CentOS / Fedora / RHEL
|
||||
register: install_gem_result
|
||||
|
||||
- name: Get stats of gem executable
|
||||
stat:
|
||||
path: "{{ output_dir }}/custom_bindir/gist"
|
||||
register: gem_bindir_stat
|
||||
|
||||
- name: Ensure gem executable was removed from custom directory
|
||||
assert:
|
||||
that:
|
||||
- install_gem_result is changed
|
||||
- not gem_bindir_stat.stat.exists
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue