Module: Enola::Platform

Defined in:
lib/enola/platform.rb

Constant Summary collapse

OS =
{ "linux" => "linux", "darwin" => "darwin", "mingw" => "windows", "mswin" => "windows" }.freeze
ARCH =
{ "x86_64" => "amd64", "amd64" => "amd64", "aarch64" => "arm64", "arm64" => "arm64" }.freeze

Class Method Summary collapse

Class Method Details

.current(config = RbConfig::CONFIG) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/enola/platform.rb', line 10

def self.current(config = RbConfig::CONFIG)
  os = OS.find { |key, _| config["host_os"].include?(key) }&.last
  arch = ARCH[config["host_cpu"]]
  raise UnsupportedPlatform, "no enola release for #{config['host_os']} on #{config['host_cpu']}" unless os && arch

  "#{os}-#{arch}"
end

.windows?(platform) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/enola/platform.rb', line 18

def self.windows?(platform)
  platform.start_with?("windows")
end