Module: ContrastAgentLib::OS

Defined in:
lib/utils/os.rb

Class Method Summary collapse

Class Method Details

.aarch64?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/utils/os.rb', line 40

def aarch64?
  @_aarch64 ||= RbConfig::CONFIG['host_cpu'].include?('aarch64')
end

.alpine?Boolean

Returns:

  • (Boolean)


34
35
36
37
38
# File 'lib/utils/os.rb', line 34

def alpine?
  return true if File.exist?("/etc/alpine-release")

  false
end

.arm_mac?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/utils/os.rb', line 22

def arm_mac?
  mac? && RbConfig::CONFIG['host_cpu'].include?('arm64')
end

.linux?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/utils/os.rb', line 30

def linux?
  (unix? and !mac?)
end

.mac?Boolean

Returns:

  • (Boolean)


17
18
19
20
# File 'lib/utils/os.rb', line 17

def mac?
  @_mac = RUBY_PLATFORM.include? 'darwin' if @_mac.nil?
  @_mac
end

.unix?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/utils/os.rb', line 26

def unix?
  !windows?
end

.windows?Boolean

Check current OS type returns true if check is correct or false if not

Returns:

  • (Boolean)


11
12
13
14
15
# File 'lib/utils/os.rb', line 11

def windows?
  return @_windows unless @_windows.nil?

  @_windows = !(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM).nil?
end