|n d dl Z d dlmZ d dlmZmZmZ d dlmZ d dl m Z d dlmZ d dl mZ dd lmZ G d de ZdS ) N)Feature)ExternalProgramFailedget_passenger_package_nameis_litespeed_running) get_ui_config)MODULES_LOGS_DIR)InstallationFailedException)installed_interpreters_list )WizardInstallerc e Zd Zej ed Zej Z d Zd Zd Z d Zd Zed ZdS ) RubyInstallerzruby.logc $ g }|D ]0}d| dd z }| | 1| j dd | | j | d S # t $ r}t |d }~ww xY w)Nzalt-ruby. z-Try to install Ruby package with versions: %s,)replaceappend app_loggerinfojoin_install_groupsr r )selfversionsgroupsvpackage_namees py/clwizard/modules/ruby.py_install_ruby_versionsz$RubyInstaller._install_ruby_versions s ( (A% #r(:(::LMM,''''LchhW_N`N`aaa 7 D &))))$ 7 7 7-//Q6 7s % A1 1 B;B Bc d}t j | sdS | d|g dS # t $ r}t |d}~ww xY w)a In order to make ruby apps work on Litespeed server, we need to run an 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.shNsh)ospathisfile_run_commandr r )r litespeed_scriptr s r _configure_for_litespeed_serverz-RubyInstaller._configure_for_litespeed_server# s{ W w~~.// F 7t%5677777$ 7 7 7-//Q6 7s > AAAc | t }t p5t di d }|o|S )a Check that the Ruby Selector is ready to work All configurations were done and Passenger is installed We always have at least one ruby package installed, because it's a dependency of the Passenger package, so we can skip that check If the config file does not exist, we ignore the uiSettings :return: already_configured status :rtype: bool uiSettingshideRubyApp)_is_package_installedr r get)r passenger_installed configs_oks r _is_already_configuredz$RubyInstaller._is_already_configured6 sb #889S9U9UVV&(h 0C0CLRT0U0U0Y0YZg0h0h,h "1z1 c g }t d }|D ]#}|j r| |j $| || d ddS )Nruby)installed_versionsavailable_versions)already_configuredoptions)r installedr versionr0 _get_available_versions)r installed_ruby_versionsinterpreters_listinterpreters r initial_statuszRubyInstaller.initial_statusE s "$7??, D DK$ D'..{/BCCC"&"="="?"?&=&*&B&B6&J&J r1 c : | dg }| | | t r| | g d d S # t $ r}t |d }~ww xY w)Nr )zcloudlinux-configsetz--jsonz:--data={"options": {"uiSettings": {"hideRubyApp": false}}})r- _install_passengerr r r( r&