File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/gem.cpython-310.pyc
o
�N�gg* � @ s� d Z ddlZddlZddlZddlZddlmZ ddiZe� e
�Zddd�Z d d d
�Z
ddd�Zdd
d�Zd!dd�Zddd�Zddd�Zd!dd�Zddd�Zddd�Zddd�Zddd�ZdS )"z
Manage ruby gems.
� N)�CommandExecutionError�list_�listc C s� |pdg| }|du r=t d |d�rt d |||d�S tjj�� s=t d |d�r=|du r4t d ||d�S t d |||d�S t d ||d
d�}|d d
krP|d S t|d ��)aI
Run the actual gem command. If rvm or rbenv is installed, run the command
using the corresponding module. rbenv is not available on windows, so don't
try.
:param command: string
Command to run
:param ruby: string : None
If RVM or rbenv are installed, the ruby version and gemset to use.
Ignored if ``gem_bin`` is specified.
:param runas: string : None
The user to run gem as.
:param gem_bin: string : None
Full path to the ``gem`` binary
:return:
Returns the full standard out including success codes or False if it fails
�gemNzrvm.is_installed)�runaszrvm.dozrbenv.is_installedzrbenv.dozrbenv.do_with_rubyzcmd.run_allF)r Zpython_shell�retcoder �stdout�stderr)Z__salt__�salt�utils�platformZ
is_windowsr )Zcommand�rubyr �gem_binZcmdline�ret� r �D/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/gem.py�_gem s �r Fc
C s� z| � � } W n ty Y nw g }
|r|
�d|g� t|||d�r3|r&|s+|
�d� |r2|
�d� n|s:|
�d� |sA|
�d� |rH|
�d� |rQ|
�d|g� | rZ|
�d | g� td
g| |
|||d�S )a�
Installs one or several gems.
:param gems: string
The gems to install
:param gem_bin: string : None
Full path to ``gem`` binary to use.
:param ruby: string : None
If RVM or rbenv are installed, the ruby version and gemset to use.
Ignored if ``gem_bin`` is specified.
:param runas: string : None
The user to run gem as.
:param version: string : None
Specify the version to install for the gem.
Doesn't play nice with multiple gems at once
:param rdoc: boolean : False
Generate RDoc documentation for the gem(s).
For rubygems > 3 this is interpreted as the --no-document arg and the
ri option will then be ignored
:param ri: boolean : False
Generate RI documentation for the gem(s).
For rubygems > 3 this is interpreted as the --no-document arg and the
rdoc option will then be ignored
:param pre_releases: boolean : False
Include pre-releases in the available versions
:param proxy: string : None
Use the specified HTTP proxy server for all outgoing traffic.
Format: http://hostname[:port]
source : None
Use the specified HTTP gem source server to download gem.
Format: http://hostname[:port]
CLI Example:
.. code-block:: bash
salt '*' gem.install vagrant
salt '*' gem.install redphone gem_bin=/opt/sensu/embedded/bin/gem
� --version�r
r r z
--no-documentz--prereleasez --no-rdocz--no-riz--prez-pz--source�install�r r )�split�AttributeError�extend�_has_rubygems_3�appendr )�gemsr
r r �versionZrdocZriZpre_releases�proxy�source�optionsr r r r <