aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/macos.rb
diff options
context:
space:
mode:
authorJack Nagel2013-04-15 15:59:19 -0500
committerJack Nagel2013-04-15 16:04:35 -0500
commitd504d50dcbf3b5744f4c415ad37fe4b8f06e18ad (patch)
tree55659a28d16827e960c2eda5f73bd816d85bed57 /Library/Homebrew/macos.rb
parent466a32df02c647b8c4eb268fabacc03526e490d4 (diff)
downloadbrew-d504d50dcbf3b5744f4c415ad37fe4b8f06e18ad.tar.bz2
Don't create MacOS.version multiple times
Diffstat (limited to 'Library/Homebrew/macos.rb')
-rw-r--r--Library/Homebrew/macos.rb22
1 files changed, 14 insertions, 8 deletions
diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb
index bb24d7a3c..5c475a72d 100644
--- a/Library/Homebrew/macos.rb
+++ b/Library/Homebrew/macos.rb
@@ -5,19 +5,25 @@ module MacOS extend self
# This can be compared to numerics, strings, or symbols
# using the standard Ruby Comparable methods.
def version
- Version.new(MACOS_VERSION)
+ @version ||= Version.new(MACOS_VERSION)
end
def cat
- # PowerPC builds per processor, not per OS
- return Hardware::CPU.family if Hardware::CPU.type == :ppc
+ @cat ||= uncached_cat
+ end
- if version == :mountain_lion then :mountain_lion
- elsif version == :lion then :lion
- elsif version == :snow_leopard
+ def uncached_cat
+ case MacOS.version
+ when 10.8
+ :mountain_lion
+ when 10.7
+ :lion
+ when 10.6
Hardware.is_64_bit? ? :snow_leopard : :snow_leopard_32
- elsif version == :leopard then :leopard
- else nil
+ when 10.5
+ :leopard
+ else
+ Hardware::CPU.family if Hardware::CPU.type == :ppc
end
end