HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/gem.cpython-310.pyc
o

�N�gg*�@s�dZddlZddlZddlZddlZddlmZddiZe�	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_�listcCs�|pdg|}|dur=td|d�rtd|||d�Stjj��s=td|d�r=|dur4td||d�Std|||d�Std	||d
d�}|dd
krP|dSt|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)rZpython_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�_gems�rFc
Cs�z|��}Wn	tyYnwg}
|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
rrz
--no-documentz--prereleasez	--no-rdocz--no-riz--prez-pz--source�install�rr)�split�AttributeError�extend�_has_rubygems_3�appendr)�gemsr
rr�versionZrdocZriZpre_releases�proxy�source�optionsrrrr<s25�

�


rcCs>z|��}Wn	tyYnwtdg|ddg|||d�S)a�
    Uninstall one or several gems.

    :param gems: string
        The gems to uninstall.
    :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.

    CLI Example:

    .. code-block:: bash

        salt '*' gem.uninstall vagrant
    �	uninstallz-az-xr�rrr�rr
rrrrrr!�s�r!cCs6z|��}Wn	tyYnwtdg||||d�S)a�
    Update one or several gems.

    :param gems: string
        The gems to update.
    :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.

    CLI Example:

    .. code-block:: bash

        salt '*' gem.update vagrant
    �updaterr"r#rrrr$�s�r$�cC�tdd|g|||d�S)a�
    Update rubygems.

    :param version: string : (newest)
        The version of rubygems 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.

    CLI Example:

    .. code-block:: bash

        salt '*' gem.update_system
    r$z--systemr�r)rr
rrrrr�
update_system��r(cCsNdg}t||||d�}i}tjj�|d�D]}t�d|�}|r$|}|Sq|S)a�
    Print out the version of gem

    :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.

    CLI Example:

    .. code-block:: bash

        salt '*' gem.version
    rr�
z[.0-9]+)rr
r�	itertoolsr�re�match)r
rr�cmdrr�liner-rrrr�s�rcCs"t�dt|||d��}|rdSdS)Nz^3\..*rTF)r,r-r)r
rrr-rrrr�srcCstdg}|r
|�|�t||||d�}i}tjj�|d�D]}t�d|�}|r7|�d�}	|�d��d�}
|
||	<q|S)a�
    List locally installed gems.

    :param prefix: string :
        Only list gems when the name matches this prefix.
    :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.

    CLI Example:

    .. code-block:: bash

        salt '*' gem.list
    rrr*z^([^ ]+) \((.+)\)��z, )	rrr
rr+rr,r-�group)�prefixr
rrr.rrr/r-rZversionsrrrrs

�c	Csdtdg|||d�}i}tjj�|d�D]}t�d|�}|r$|��\}}nt�	d|�q|||<q|S)a�
    .. versionadded:: 2015.8.0

    Check if an upgrade is available for installed gems

    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.
    runas : None
        The user to run gem as.

    CLI Example:

    .. code-block:: bash

        salt '*' gem.list_upgrades
    Zoutdatedrr*z(\S+) \(\S+ < (\S+)\)zCan't parse line '%s')
rr
rr+rr,�search�groups�log�error)	r
rr�resultrr/r-�namerrrr�
list_upgrades"s
r:cCr&)a�
    Add a gem source.

    :param source_uri: string
        The source URI to add.
    :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.

    CLI Example:

    .. code-block:: bash

        salt '*' gem.sources_add http://rubygems.org/
    �sourcesz--addrr'�Z
source_urir
rrrrr�sources_addCr)r=cCr&)a�
    Remove a gem source.

    :param source_uri: string
        The source URI to remove.
    :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.

    CLI Example:

    .. code-block:: bash

        salt '*' gem.sources_remove http://rubygems.org/
    r;z--removerr'r<rrr�sources_removeZr)r>cCs.tdg|||d�}|durgS|��dd�S)a�
    List the configured gem sources.

    :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.

    CLI Example:

    .. code-block:: bash

        salt '*' gem.sources_list
    r;rFr1N)r�
splitlines)r
rrrrrr�sources_listqsr@)NNN)	NNNNFFFNN)r%NNN)�__doc__�loggingr,Zsalt.utils.itertoolsr
Zsalt.utils.platformZsalt.exceptionsrZ__func_alias__�	getLogger�__name__r6rrr!r$r(rrrr:r=r>r@rrrr�<module>s:

-
�
Q





"
!