Baptiste Fontaine d6dd63d1a0 OS: use RbConfig instead of RUBY_PLATFORM
`RUBY_PLATFORM` is always `"java"` when running JRuby, no matter what is
the underlying platform.

See also https://github.com/pry/pry/issues/386.
2017-07-26 22:26:30 +02:00

31 lines
882 B
Ruby

require "rbconfig"
module OS
def self.mac?
return false if ENV["HOMEBREW_TEST_GENERIC_OS"]
RbConfig::CONFIG["host_os"].include? "darwin"
end
def self.linux?
return false if ENV["HOMEBREW_TEST_GENERIC_OS"]
RbConfig::CONFIG["host_os"].include? "linux"
end
::OS_VERSION = ENV["HOMEBREW_OS_VERSION"]
if OS.mac?
require "os/mac"
# Don't tell people to report issues on unsupported versions of macOS.
if !OS::Mac.prerelease? && !OS::Mac.outdated_release?
ISSUES_URL = "http://docs.brew.sh/Troubleshooting.html".freeze
end
PATH_OPEN = "/usr/bin/open".freeze
# compatibility
::MACOS_FULL_VERSION = OS::Mac.full_version.to_s.freeze
::MACOS_VERSION = OS::Mac.version.to_s.freeze
elsif OS.linux?
ISSUES_URL = "https://github.com/Linuxbrew/brew/wiki/troubleshooting".freeze
PATH_OPEN = "xdg-open".freeze
end
end