Module: Lich::Common::RubyExecutable
- Defined in:
- documented/common/ruby_executable.rb
Overview
Selects the Ruby executable used to start another Lich process.
Class Method Summary collapse
-
.resolve(platform_key: Frontend.platform_key, configured_ruby: RbConfig.ruby) ⇒ String
Prefer the installed windowless Ruby companion on Windows.
Class Method Details
.resolve(platform_key: Frontend.platform_key, configured_ruby: RbConfig.ruby) ⇒ String
Prefer the installed windowless Ruby companion on Windows.
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'documented/common/ruby_executable.rb', line 18 def self.resolve(platform_key: Frontend.platform_key, configured_ruby: RbConfig.ruby) raise ArgumentError, 'configured Ruby executable must not be empty' if configured_ruby.to_s.empty? platform_key = Frontend.validate_platform_key!(platform_key) return configured_ruby unless platform_key == :windows windowed_ruby = configured_ruby.sub(/ruby(?:\.exe)?$/i, 'rubyw.exe') return configured_ruby if windowed_ruby == configured_ruby File.file?(windowed_ruby) ? windowed_ruby : configured_ruby rescue SystemCallError configured_ruby end |