2024.8.23
Loading...
Searching...
No Matches
ToolRuby Class Reference
+ Inheritance diagram for ToolRuby:
+ Collaboration diagram for ToolRuby:

Public Member Functions

 __construct ($id, $type)
 
 getConsoleExe ()
 
 getExe ()
 
 reload ($id=null, $type=null)
 
 setVersion ($version)
 
- Public Member Functions inherited from Module
 __toString ()
 
 getCurrentPath ()
 
 getId ()
 
 getName ()
 
 getRelease ()
 
 getRootPath ()
 
 getSymlinkPath ()
 
 getType ()
 
 getVersion ()
 
 getVersionList ()
 
 isEnable ()
 
 update ($sub=0, $showWindow=false)
 

Data Fields

const LOCAL_CFG_CONSOLE_EXE = 'rubyConsoleExe'
 
const LOCAL_CFG_EXE = 'rubyExe'
 
const ROOT_CFG_VERSION = 'rubyVersion'
 
- Data Fields inherited from Module
const BUNDLE_RELEASE = 'bundleRelease'
 

Private Attributes

 $consoleExe
 
 $exe
 

Additional Inherited Members

- Protected Member Functions inherited from Module
 __construct ()
 
 replace ($key, $value)
 
 replaceAll ($params)
 
 updateConfig ($version=null, $sub=0, $showWindow=false)
 
- Protected Attributes inherited from Module
 $bearsamppConf
 
 $bearsamppConfRaw
 
 $currentPath
 
 $enable
 
 $name
 
 $release = 'N/A'
 
 $rootPath
 
 $symlinkPath
 
 $version
 

Detailed Description

Class ToolRuby

This class represents a Ruby tool module in the Bearsampp application. It extends the Module class and provides functionalities specific to managing Ruby tools, including loading configurations, setting versions, and retrieving executable paths.

Definition at line 18 of file class.tool.ruby.php.

Constructor & Destructor Documentation

◆ __construct()

ToolRuby::__construct ( $id,
$type )

Constructor for the ToolRuby class.

Parameters
string$idThe ID of the module.
string$typeThe type of the module.

Definition at line 51 of file class.tool.ruby.php.

51 {
52 Util::logInitClass($this);
53 $this->reload($id, $type);
54 }
reload($id=null, $type=null)
static logInitClass($classInstance)

References Module\$id, Module\$type, Util\logInitClass(), and reload().

Member Function Documentation

◆ getConsoleExe()

ToolRuby::getConsoleExe ( )

Gets the path to the Ruby console executable.

Returns
string The path to the Ruby console executable.

Definition at line 123 of file class.tool.ruby.php.

123 {
124 return $this->consoleExe;
125 }

References $consoleExe.

◆ getExe()

ToolRuby::getExe ( )

Gets the path to the Ruby executable.

Returns
string The path to the Ruby executable.

Definition at line 114 of file class.tool.ruby.php.

114 {
115 return $this->exe;
116 }

References $exe.

◆ reload()

ToolRuby::reload ( $id = null,
$type = null )

Reloads the Ruby tool configuration based on the provided ID and type.

Parameters
string | null$idThe ID of the module. If null, the current ID is used.
string | null$typeThe type of the module. If null, the current type is used.

Reimplemented from Module.

Definition at line 62 of file class.tool.ruby.php.

62 {
65
66 $this->name = $bearsamppLang->getValue(Lang::RUBY);
67 $this->version = $bearsamppConfig->getRaw(self::ROOT_CFG_VERSION);
68 parent::reload($id, $type);
69
70 if ($this->bearsamppConfRaw !== false) {
71 $this->exe = $this->symlinkPath . '/' . $this->bearsamppConfRaw[self::LOCAL_CFG_EXE];
72 $this->consoleExe = $this->symlinkPath . '/' . $this->bearsamppConfRaw[self::LOCAL_CFG_CONSOLE_EXE];
73 }
74
75 if (!$this->enable) {
76 Util::logInfo($this->name . ' is not enabled!');
77 return;
78 }
79 if (!is_dir($this->currentPath)) {
80 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->currentPath));
81 }
82 if (!is_dir($this->symlinkPath)) {
83 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_FILE_NOT_FOUND), $this->name . ' ' . $this->version, $this->symlinkPath));
84 return;
85 }
86 if (!is_file($this->bearsamppConf)) {
87 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_CONF_NOT_FOUND), $this->name . ' ' . $this->version, $this->bearsamppConf));
88 }
89 if (!is_file($this->exe)) {
90 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_EXE_NOT_FOUND), $this->name . ' ' . $this->version, $this->exe));
91 }
92 if (!is_file($this->consoleExe)) {
93 Util::logError(sprintf($bearsamppLang->getValue(Lang::ERROR_EXE_NOT_FOUND), $this->name . ' ' . $this->version, $this->consoleExe));
94 }
95 }
global $bearsamppLang
const RUBY
const ERROR_FILE_NOT_FOUND
const ERROR_CONF_NOT_FOUND
const ERROR_EXE_NOT_FOUND
const LOCAL_CFG_CONSOLE_EXE
const LOCAL_CFG_EXE
static logReloadClass($classInstance)
static logError($data, $file=null)
static logInfo($data, $file=null)
global $bearsamppConfig
Definition homepage.php:26

References $bearsamppConfig, $bearsamppLang, Module\$id, Module\$type, Lang\ERROR_CONF_NOT_FOUND, Lang\ERROR_EXE_NOT_FOUND, Lang\ERROR_FILE_NOT_FOUND, LOCAL_CFG_CONSOLE_EXE, LOCAL_CFG_EXE, Util\logError(), Util\logInfo(), Util\logReloadClass(), and Lang\RUBY.

Referenced by __construct(), and setVersion().

+ Here is the caller graph for this function:

◆ setVersion()

ToolRuby::setVersion ( $version)

Sets the version of the Ruby tool and reloads the configuration.

Parameters
string$versionThe version to set.

Reimplemented from Module.

Definition at line 102 of file class.tool.ruby.php.

102 {
103 global $bearsamppConfig;
104 $this->version = $version;
105 $bearsamppConfig->replace(self::ROOT_CFG_VERSION, $version);
106 $this->reload();
107 }

References $bearsamppConfig, Module\$version, and reload().

Field Documentation

◆ $consoleExe

ToolRuby::$consoleExe
private

Definition at line 43 of file class.tool.ruby.php.

Referenced by getConsoleExe().

◆ $exe

ToolRuby::$exe
private

Definition at line 38 of file class.tool.ruby.php.

Referenced by getExe().

◆ LOCAL_CFG_CONSOLE_EXE

const ToolRuby::LOCAL_CFG_CONSOLE_EXE = 'rubyConsoleExe'

Configuration key for the Ruby console executable in the local configuration.

Definition at line 33 of file class.tool.ruby.php.

Referenced by reload().

◆ LOCAL_CFG_EXE

const ToolRuby::LOCAL_CFG_EXE = 'rubyExe'

Configuration key for the Ruby executable in the local configuration.

Definition at line 28 of file class.tool.ruby.php.

Referenced by reload().

◆ ROOT_CFG_VERSION

const ToolRuby::ROOT_CFG_VERSION = 'rubyVersion'

Configuration key for the Ruby version in the root configuration.

Definition at line 23 of file class.tool.ruby.php.


The documentation for this class was generated from the following file: