Module: R10K::Util::Platform

Defined in:
lib/r10k/util/platform.rb

Constant Summary collapse

FIPS_FILE =
"/proc/sys/crypto/fips_enabled"

Class Method Summary collapse

Class Method Details

.fips?Boolean

We currently only suport FIPS mode on redhat 7, where it is toggled via a file.

Returns:

  • (Boolean)


21
22
23
24
25
26
27
# File 'lib/r10k/util/platform.rb', line 21

def self.fips?
  if File.exist?(FIPS_FILE)
    File.read(FIPS_FILE).chomp == "1"
  else
    false
  end
end

.jruby?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/r10k/util/platform.rb', line 33

def self.jruby?
  RUBY_PLATFORM == "java"
end

.platformObject



8
9
10
11
12
13
14
15
16
17
# File 'lib/r10k/util/platform.rb', line 8

def self.platform
  # Test JRuby first to handle JRuby on Windows as well.
  if self.jruby?
    :jruby
  elsif self.windows?
    :windows
  else
    :posix
  end
end

.posix?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/r10k/util/platform.rb', line 37

def self.posix?
  !windows? && !jruby?
end

.windows?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/r10k/util/platform.rb', line 29

def self.windows?
  RbConfig::CONFIG['host_os'] =~ /mswin|win32|dos|mingw|cygwin/i
end