MacOS: full_version added
Closes Homebrew/homebrew#44988. Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
parent
0915f0c668
commit
abfaa59e06
@ -770,6 +770,10 @@ class FormulaAuditor
|
||||
problem "Use MacOS.version instead of MACOS_VERSION"
|
||||
end
|
||||
|
||||
if line =~ /MACOS_FULL_VERSION/
|
||||
problem "Use MacOS.full_version instead of MACOS_FULL_VERSION"
|
||||
end
|
||||
|
||||
cats = %w[leopard snow_leopard lion mountain_lion].join("|")
|
||||
if line =~ /MacOS\.(?:#{cats})\?/
|
||||
problem "\"#{$&}\" is deprecated, use a comparison to MacOS.version instead"
|
||||
|
@ -145,7 +145,7 @@ module Homebrew
|
||||
f.puts "HOMEBREW_CELLAR: #{HOMEBREW_CELLAR}"
|
||||
f.puts "HOMEBREW_BOTTLE_DOMAIN: #{BottleSpecification::DEFAULT_DOMAIN}"
|
||||
f.puts hardware
|
||||
f.puts "OS X: #{MACOS_FULL_VERSION}-#{kernel}"
|
||||
f.puts "OS X: #{MacOS.full_version}-#{kernel}"
|
||||
f.puts "Xcode: #{xcode ? xcode : "N/A"}"
|
||||
f.puts "CLT: #{clt ? clt : "N/A"}"
|
||||
f.puts "GCC-4.0: build #{gcc_40}" if gcc_40
|
||||
|
@ -34,7 +34,7 @@ module Homebrew
|
||||
auth = :AUTH_BASIC
|
||||
end
|
||||
|
||||
url = new_issue(f.tap, "#{f.name} failed to build on #{MACOS_FULL_VERSION}", url, auth)
|
||||
url = new_issue(f.tap, "#{f.name} failed to build on #{MacOS.full_version}", url, auth)
|
||||
end
|
||||
|
||||
puts url if url
|
||||
|
@ -26,15 +26,6 @@ else
|
||||
end
|
||||
RUBY_BIN = RUBY_PATH.dirname
|
||||
|
||||
if RUBY_PLATFORM =~ /darwin/
|
||||
MACOS_FULL_VERSION = `/usr/bin/sw_vers -productVersion`.chomp
|
||||
MACOS_VERSION = MACOS_FULL_VERSION[/10\.\d+/]
|
||||
OS_VERSION = "OS X #{MACOS_FULL_VERSION}"
|
||||
else
|
||||
MACOS_FULL_VERSION = MACOS_VERSION = "0"
|
||||
OS_VERSION = RUBY_PLATFORM
|
||||
end
|
||||
|
||||
HOMEBREW_GITHUB_API_TOKEN = ENV["HOMEBREW_GITHUB_API_TOKEN"]
|
||||
HOMEBREW_USER_AGENT = "Homebrew #{HOMEBREW_VERSION} (Ruby #{RUBY_VERSION}-#{RUBY_PATCHLEVEL}; #{OS_VERSION})"
|
||||
|
||||
|
@ -8,11 +8,19 @@ module OS
|
||||
end
|
||||
|
||||
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
|
||||
::OS_VERSION = "OS X #{MACOS_FULL_VERSION}"
|
||||
elsif OS.linux?
|
||||
ISSUES_URL = "https://github.com/Homebrew/linuxbrew/wiki/troubleshooting"
|
||||
PATH_OPEN = "xdg-open"
|
||||
# compatibility
|
||||
::MACOS_FULL_VERSION = ::MACOS_VERSION = "0"
|
||||
::OS_VERSION = RUBY_PLATFORM
|
||||
else
|
||||
raise "Unknown operating system"
|
||||
end
|
||||
|
@ -12,7 +12,13 @@ module OS
|
||||
# This can be compared to numerics, strings, or symbols
|
||||
# using the standard Ruby Comparable methods.
|
||||
def version
|
||||
@version ||= Version.new(MACOS_VERSION)
|
||||
@version ||= Version.new(full_version.to_s[/10\.\d+/])
|
||||
end
|
||||
|
||||
# This can be compared to numerics, strings, or symbols
|
||||
# using the standard Ruby Comparable methods.
|
||||
def full_version
|
||||
@full_version ||= Version.new(`/usr/bin/sw_vers -productVersion`.chomp)
|
||||
end
|
||||
|
||||
def cat
|
||||
|
Loading…
x
Reference in New Issue
Block a user