Module: ContrastAgentLib::OS

Included in:
ContrastAgentLib
Defined in:
lib/utils/os.rb

Class Method Summary collapse

Class Method Details

.alpine?Boolean

Returns:

  • (Boolean)


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

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

  false
end

.linux?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/utils/os.rb', line 24

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

.mac?Boolean

Returns:

  • (Boolean)


15
16
17
18
# File 'lib/utils/os.rb', line 15

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

.unix?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/utils/os.rb', line 20

def unix?
  !windows?
end

.windows?Boolean

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

Returns:

  • (Boolean)


9
10
11
12
13
# File 'lib/utils/os.rb', line 9

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

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