gddlZddlmZddlmZmZmZddlmZddl m Z ddl m Z ddl mZdd lmZGd d eZdS) N)Feature)ExternalProgramFailedget_passenger_package_nameis_litespeed_running) get_ui_config)MODULES_LOGS_DIR)InstallationFailedException)installed_interpreters_list)WizardInstallerceZdZejedZej Z dZ dZ dZ dZdZedZdS) RubyInstallerzruby.logc$g}|D]0}d|ddz}||1|jdd| |j|dS#t $r}t|d}~wwxYw)Nzalt-ruby.z-Try to install Ruby package with versions: %s,)replaceappend app_loggerinfojoin_install_groupsrr )selfversionsgroupsv package_namees py/clwizard/modules/ruby.py_install_ruby_versionsz$RubyInstaller._install_ruby_versionss ( (A% #r(:(::L MM, ' ' ' ' LchhW_N`N`aaa 7 D & ) ) ) )$ 7 7 7-//Q 6 7s% A11 B;B  Bcd}tj|sdS |d|gdS#t$r}t |d}~wwxYw)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_commandrr )rlitespeed_scriptrs r_configure_for_litespeed_serverz-RubyInstaller._configure_for_litespeed_server#s{Ww~~.//  F 7   t%56 7 7 7 7 7$ 7 7 7-//Q 6 7s> AAAc|t}t p5tdid }|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 uiSettings hideRubyApp)_is_package_installedrrget)rpassenger_installed configs_oks r_is_already_configuredz$RubyInstaller._is_already_configured6sb#889S9U9UVV&(h 0C0CLRT0U0U0Y0YZg0h0h,h "1z1cg}td}|D]#}|jr||j$|||dddS)Nruby)installed_versionsavailable_versions)already_configuredoptions)r installedrversionr0_get_available_versions)rinstalled_ruby_versionsinterpreters_list interpreters rinitial_statuszRubyInstaller.initial_statusEs"$7??, D DK$ D'..{/BCCC"&"="="?"?&=&*&B&B6&J&J   r1c:|dg}|||tr| |gddS#t $r}t|d}~wwxYw)Nr)zcloudlinux-configsetz--jsonz:--data={"options": {"uiSettings": {"hideRubyApp": false}}})r-_install_passengerr rr(r&rr )rr7install_versionsrs rrun_installationzRubyInstaller.run_installationSs";;z266 !!! ##$4555  ! ! 3  0 0 2 2 2 7        % 7 7 7-//Q 6 7s#A<< BBBcdhS)Nr)clss rsupported_optionszRubyInstaller.supported_optionsgs |r1N)__name__ __module__ __qualname__r#r$rrLOG_FILEr RUBY_SELECTOR_REQUIRED_CL_COMPONENT_SUPPORTr r(r0r>rC classmethodrGrEr1rrrsw||,j99H%,%:" 7 7 7777& 2 2 2    777([r1r)r#clcommon.constrclcommon.utilsrrrclconfig.ui_config_librclwizard.constantsrclwizard.exceptionsr clwizard.utilsr baser rrEr1rrVs """"""bbbbbbbbbb000000//////;;;;;;666666!!!!!!UUUUUOUUUUUr1