
If the environment variable HOMEBREW_TEST_GENERIC_OS is set ensure that neither Mac nor Linux-specific code is loaded. This allows easier testing of cross-platform code on OS X and will make it easier to port Homebrew to platforms other than OS X and Linux.
24 lines
572 B
Ruby
24 lines
572 B
Ruby
module OS
|
|
def self.mac?
|
|
/darwin/i === RUBY_PLATFORM && !ENV["HOMEBREW_TEST_GENERIC_OS"]
|
|
end
|
|
|
|
def self.linux?
|
|
/linux/i === RUBY_PLATFORM
|
|
end
|
|
|
|
::OS_VERSION = ENV["HOMEBREW_OS_VERSION"]
|
|
|
|
if OS.mac?
|
|
require "os/mac"
|
|
ISSUES_URL = "https://git.io/brew-troubleshooting"
|
|
PATH_OPEN = "/usr/bin/open"
|
|
# compatibility
|
|
::MACOS_FULL_VERSION = OS::Mac.full_version.to_s
|
|
::MACOS_VERSION = OS::Mac.version.to_s
|
|
elsif OS.linux?
|
|
ISSUES_URL = "https://github.com/Homebrew/linuxbrew/wiki/troubleshooting"
|
|
PATH_OPEN = "xdg-open"
|
|
end
|
|
end
|