HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/gem.cpython-310.pyc
o

�N�gk�@sldZddlZddlZddlZe�e�Zdd�Z									ddd�Z	ddd	�Z
dd
d�Zddd
�ZdS)a�
Installation of Ruby modules packaged as gems
=============================================

A state module to manage rubygems. Gems can be set up to be installed
or removed. This module will use RVM or rbenv if they are installed. In that case,
you can specify what ruby version and gemset to target.

.. code-block:: yaml

    addressable:
      gem.installed:
        - user: rvm
        - ruby: jruby@jgemset
�NcCsdtvrdSdS)z:
    Only load if gem module is available in __salt__
    �gem.listT)Fzgem module could not be loaded)�__salt__�rr�C/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/gem.py�__virtual__srFc
Cs�|ddid�}
|durtd|d�std|d�st�d�td||||d	�}||vry|duryt�d
|�}|rf|��}
t�dd||d���}t�|
d|���}tj	j
�||
|�red
|
d<d|
d<|
Sn%t|�||vrxd
|
d<d|
d<|
Sn||vr�|dur�d
|
d<d|
d<|
St
dr�d|�d�|
d<|
Std||||||||||	d�
r�d
|
d<d|
d|<d|
d<|
Sd|
d<d|
d<|
S)a_
    Make sure that a gem is installed.

    name
        The name of the gem to install

    ruby: None
        Only for RVM or rbenv installations: the ruby version and gemset to
        target.

    gem_bin: None
        Custom ``gem`` command to run instead of the default.
        Use this to install gems to a non-default ruby install. If you are
        using rvm or rbenv use the ruby argument instead.

    user: None
        The user under which to run the ``gem`` command

        .. versionadded:: 0.17.0

    version : None
        Specify the version to install for the gem.
        Doesn't play nice with multiple gems at once

    rdoc : False
        Generate RDoc documentation for the gem(s).

    ri : False
        Generate RI documentation for the gem(s).

    pre_releases : False
        Install pre-release version of gem(s) if available.

    proxy : 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]
    N���name�result�comment�changeszrvm.is_installed��runaszrbenv.is_installedzAUse of argument ruby found, but neither rvm or rbenv is installedr��gem_binrz(>=|>|<|<=)z	default: rTr
z)Installed Gem meets version requirements.rzGem is already installed.�test�The gem z would have been installedzgem.install)	�rubyrr�version�rdoc�ri�pre_releases�proxy�source�	InstalledrzGem was successfully installedFzCould not install gem.)r�log�warning�re�match�group�sub�strip�salt�utilsZversionsZcompare�str�__opts__)r	rr�userrrrrrr�retZgemsrZcmprZinstalled_versionZdesired_versionrrr�	installed"sd5��
����r(cCs�|ddid�}|td||||d�vrd|d<d|d	<|Std
r+d|�d�|d	<|Std
||||d�rEd|d<d|d|<d|d	<|Sd|d<d|d	<|S)a�
    Make sure that a gem is not installed.

    name
        The name of the gem to uninstall

    gem_bin : None
        Full path to ``gem`` binary to use.

    ruby : None
        If RVM or rbenv are installed, the ruby version and gemset to use.
        Ignored if ``gem_bin`` is specified.

    user: None
        The user under which to run the ``gem`` command

        .. versionadded:: 0.17.0
    NrrrrTr
zGem is not installed.rrrz would have been removedz
gem.uninstall�RemovedrzGem was successfully removed.FzCould not remove gem.�rr%)r	rr&rr'rrr�removed�s �r+cCs�|ddid�}|td||d�vrd|d<d|d	<|Std
r)d|�d�|d	<|Std
|||d�rBd|d<d|d|<d|d	<|Sd|d<d|d	<|S)a0
    Make sure that a gem source is added.

    name
        The URL of the gem source to be added

    ruby: None
        For RVM or rbenv installations: the ruby version and gemset to target.

    user: None
        The user under which to run the ``gem`` command

        .. versionadded:: 0.17.0
    Nrr�gem.sources_listr
Tr
zGem source is already added.rrzThe gem source z would have been added.zgem.sources_add�Z
source_urirrrrz"Gem source was successfully added.FzCould not add gem source.r*�r	rr&r'rrr�sources_add�s �r/cCs�|ddid�}|td||d�vrd|d<d|d	<|Std
r%d|d	<|Std|||d
�r>d|d<d|d|<d|d	<|Sd|d<d|d	<|S)a4
    Make sure that a gem source is removed.

    name
        The URL of the gem source to be removed

    ruby: None
        For RVM or rbenv installations: the ruby version and gemset to target.

    user: None
        The user under which to run the ``gem`` command

        .. versionadded:: 0.17.0
    Nrrr,r
Tr
zGem source is already removed.rrz'The gem source would have been removed.zgem.sources_remover-r)rz$Gem source was successfully removed.FzCould not remove gem source.r*r.rrr�sources_remove�s �r0)	NNNNFFFNN)NNN)NN)
�__doc__�loggingrZsalt.utils.versionsr"�	getLogger�__name__rrr(r+r/r0rrrr�<module>s&

�
o
'"