|9eddlmZddlZddlmZddlmZddlmZddl m Z m Z m Z ddl mZdd lmZdd lmZGd d eZdS) )absolute_importN)WizardInstaller)InstallationFailedException)MODULES_LOGS_DIR)ExternalProgramFailedis_litespeed_runningget_passenger_package_name)installed_interpreters_list) get_ui_config)FeatureceZdZejedZej Z fdZ dZ dZ dZdZdZedZxZS) RubyInstallerzruby.logcVtt|dS)N)superr__init__)self __class__s L/opt/cloudlinux/venv/lib64/python3.11/site-packages/clwizard/modules/ruby.pyrzRubyInstaller.__init__s% mT""++-----cg}|D]0}d|ddz}||1|jdd| |j|dS#t $rtwxYw)Nzalt-ruby.z-Try to install Ruby package with versions: %s,)replaceappend app_loggerinfojoin_install_yum_groupsrr)rversionsgroupsv package_names r_install_ruby_versionsz$RubyInstaller._install_ruby_versionss ( (A% #r(:(::L MM, ' ' ' ' LchhW_N`N`aaa 0 $D $f - - - -$ 0 0 0-// / 0s % A11B cd}tj|sdS |d|gdS#t$rt wxYw)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.shNsh)ospathisfile _run_commandrr)rlitespeed_scripts r_configure_for_litespeed_serverz-RubyInstaller._configure_for_litespeed_server*suWw~~.//  F 0   t%56 7 7 7 7 7$ 0 0 0-// / 0s >Ac|toDt p5tdid 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 uiSettings hideRubyApp)_is_package_installedr r get)rs r_is_already_configuredz$RubyInstaller._is_already_configured<s`))*D*F*FGGK J$$\266::=II I Krcg}td}|D]#}|jr||j$|||dddS)Nruby)installed_versionsavailable_versions)already_configuredoptions)r installedrversionr3_get_available_versions)rinstalled_ruby_versionsinterpreters_list interpreters rinitial_statuszRubyInstaller.initial_statusKs"$7??, D DK$ D'..{/BCCC"&"="="?"?&=&*&B&B6&J&J   rc0|dg}|||tr| |gddS#t $rtwxYw)Nr!)zcloudlinux-configsetz--jsonz:--data={"options": {"uiSettings": {"hideRubyApp": false}}})r2_install_passengerr%r r-r+rr)rr9install_versionss rrun_installationzRubyInstaller.run_installationZs";;z266 !!! ##$4555  ! ! 3  0 0 2 2 2 0   ]]] ^ ^ ^ ^ ^$ 0 0 0-// / 0s #A<<BcdhS)Nr!)clss rsupported_optionszRubyInstaller.supported_optionshs |r)__name__ __module__ __qualname__r(r)rrLOG_FILEr RUBY_SELECTOR_REQUIRED_CL_COMPONENT_SUPPORTrr%r-r3r@rE classmethodrI __classcell__)rs@rrrsw||,j99H%,%:"..... 0 0 0000$ K K K     0 0 0[rr) __future__rr(baserclwizard.exceptionsrclwizard.constantsrclcommon.utilsrr r clwizard.utilsr clconfig.ui_config_libr clcommon.constr rrGrrrZs'&&&&& !!!!!!;;;;;;////// 766666000000""""""RRRRRORRRRRr