%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /opt/alt/python37/lib/python3.7/site-packages/clwizard/modules/__pycache__/
Upload File :
Create Path :
Current File : //opt/alt/python37/lib/python3.7/site-packages/clwizard/modules/__pycache__/ruby.cpython-37.pyc

B

�2Lb��@s�ddlmZddlZddlmZddlmZddlmZddl	m
Z
mZmZddl
mZdd	lmZdd
lmZGdd�de�ZdS)
�)�absolute_importN�)�WizardInstaller)�InstallationFailedException)�MODULES_LOGS_DIR)�ExternalProgramFailed�is_litespeed_running�get_passenger_package_name)�installed_interpreters_list)�
get_ui_config)�FeaturecsdeZdZej�ed�Zej	Z
�fdd�Zdd�Zdd�Z
dd	�Zd
d�Zdd
�Zedd��Z�ZS)�
RubyInstallerzruby.logcstt|���dS)N)�superr
�__init__)�self)�	__class__��F/opt/alt/python37/lib/python3.7/site-packages/clwizard/modules/ruby.pyrszRubyInstaller.__init__cCsng}x&|D]}d|�dd�}|�|�q
W|j�dd�|��y|j|�Wntk
rht��YnXdS)Nzalt-ruby�.�z-Try to install Ruby package with versions: %s�,)�replace�appendZ
app_logger�info�joinZ_install_yum_groupsrr)r�versions�groups�vZpackage_namerrr�_install_ruby_versionss
z$RubyInstaller._install_ruby_versionscCsFd}tj�|�sdSy|�d|g�Wntk
r@t��YnXdS)a
        In order to make ruby apps work on Litespeed server
        we need to do run extra script
        see docs for details:
        https://www.litespeedtech.com/support/wiki/doku.php/litespeed_wiki:cloudlinux:enable_passenger
        :return:
        z9/usr/local/lsws/admin/misc/enable_ruby_python_selector.shNZsh)�os�path�isfile�_run_commandrr)rZlitespeed_scriptrrr�_configure_for_litespeed_server*sz-RubyInstaller._configure_for_litespeed_servercCs*|�t��o(t�p(t��di��d�S)a�
        Check that ruby selector is ready to work
        All configurations were done:
        - passenger is installed
        We always have at least one ruby package installed,
        because it is dependency of passenger package, so we can skip such check
        If the config file does not exist, we ignore the uiSettings
        :return: already_configured status
        :rtype: bool
        Z
uiSettingsZhideRubyApp)Z_is_package_installedr	r�get)rrrr�_is_already_configured<sz$RubyInstaller._is_already_configuredcCsFg}td�}x|D]}|jr|�|j�qW|��||�d�d�d�S)NZruby)Zinstalled_versionsZavailable_versions)Zalready_configured�options)r
Z	installedr�versionr%Z_get_available_versions)rZinstalled_ruby_versionsZinterpreters_listZinterpreterrrr�initial_statusKs
zRubyInstaller.initial_statuscCsb|�dg�}|��|�|�t�r,|��y|�ddddg�Wntk
r\t��YnXdS)Nrzcloudlinux-config�setz--jsonz:--data={"options": {"uiSettings": {"hideRubyApp": false}}})r$Z_install_passengerrrr#r"rr)rr&Zinstall_versionsrrr�run_installationZs

zRubyInstaller.run_installationcCsdhS)Nrr)�clsrrr�supported_optionshszRubyInstaller.supported_options)�__name__�
__module__�__qualname__rr rrZLOG_FILErZ
RUBY_SELECTORZ_REQUIRED_CL_COMPONENT_SUPPORTrrr#r%r(r*�classmethodr,�
__classcell__rr)rrr
sr
)Z
__future__rr�baserZclwizard.exceptionsrZclwizard.constantsrZclcommon.utilsrrr	Zclwizard.utilsr
Zclconfig.ui_config_librZclcommon.constrr
rrrr�<module>	s

Zerion Mini Shell 1.0