Document OS
.
This commit is contained in:
parent
2484ddb565
commit
dbfc6dc7a5
@ -1,18 +1,30 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
# Helper functions for querying operating system information.
|
||||||
|
#
|
||||||
|
# @api private
|
||||||
module OS
|
module OS
|
||||||
|
# Check if the operating system is macOS.
|
||||||
|
#
|
||||||
|
# @api public
|
||||||
def self.mac?
|
def self.mac?
|
||||||
return false if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
return false if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
||||||
|
|
||||||
RbConfig::CONFIG["host_os"].include? "darwin"
|
RbConfig::CONFIG["host_os"].include? "darwin"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Check if the operating system is Linux.
|
||||||
|
#
|
||||||
|
# @api public
|
||||||
def self.linux?
|
def self.linux?
|
||||||
return false if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
return false if ENV["HOMEBREW_TEST_GENERIC_OS"]
|
||||||
|
|
||||||
RbConfig::CONFIG["host_os"].include? "linux"
|
RbConfig::CONFIG["host_os"].include? "linux"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get the kernel version.
|
||||||
|
#
|
||||||
|
# @api public
|
||||||
def self.kernel_version
|
def self.kernel_version
|
||||||
@kernel_version ||= Version.new(Utils.safe_popen_read("uname", "-r").chomp)
|
@kernel_version ||= Version.new(Utils.safe_popen_read("uname", "-r").chomp)
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user