aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/audit.rb4
-rw-r--r--Library/Homebrew/cmd/config.rb2
-rw-r--r--Library/Homebrew/cmd/gist-logs.rb2
-rw-r--r--Library/Homebrew/global.rb9
-rw-r--r--Library/Homebrew/os.rb8
-rw-r--r--Library/Homebrew/os/mac.rb8
6 files changed, 21 insertions, 12 deletions
diff --git a/Library/Homebrew/cmd/audit.rb b/Library/Homebrew/cmd/audit.rb
index f3a97fdb4..da07d207f 100644
--- a/Library/Homebrew/cmd/audit.rb
+++ b/Library/Homebrew/cmd/audit.rb
@@ -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"
diff --git a/Library/Homebrew/cmd/config.rb b/Library/Homebrew/cmd/config.rb
index fb8395135..2281f644c 100644
--- a/Library/Homebrew/cmd/config.rb
+++ b/Library/Homebrew/cmd/config.rb
@@ -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
diff --git a/Library/Homebrew/cmd/gist-logs.rb b/Library/Homebrew/cmd/gist-logs.rb
index db89f8e2e..495041a71 100644
--- a/Library/Homebrew/cmd/gist-logs.rb
+++ b/Library/Homebrew/cmd/gist-logs.rb
@@ -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
diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb
index 4ab84941c..277994476 100644
--- a/Library/Homebrew/global.rb
+++ b/Library/Homebrew/global.rb
@@ -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})"
diff --git a/Library/Homebrew/os.rb b/Library/Homebrew/os.rb
index 93df62b7d..1b8ed7b8e 100644
--- a/Library/Homebrew/os.rb
+++ b/Library/Homebrew/os.rb
@@ -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
diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb
index 2fda9c085..691f92b51 100644
--- a/Library/Homebrew/os/mac.rb
+++ b/Library/Homebrew/os/mac.rb
@@ -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