Deprecate MacOS.version? style methods

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
This commit is contained in:
Jack Nagel 2012-08-14 11:37:29 -05:00
parent b8231fc5f3
commit 166a9ba0ed
6 changed files with 29 additions and 34 deletions

View File

@ -796,7 +796,7 @@ def check_git_status
end end
def check_for_leopard_ssl def check_for_leopard_ssl
if MacOS.leopard? and not ENV['GIT_SSL_NO_VERIFY'] if MacOS.version == :leopard and not ENV['GIT_SSL_NO_VERIFY']
<<-EOS.undent <<-EOS.undent
The version of libcurl provided with Mac OS X Leopard has outdated The version of libcurl provided with Mac OS X Leopard has outdated
SSL certificates. SSL certificates.

View File

@ -197,4 +197,23 @@ module MacOS extend self
def x11_prefix def x11_prefix
X11.prefix X11.prefix
end end
def leopard?
10.5 == MACOS_VERSION
end
def snow_leopard?
10.6 <= MACOS_VERSION # Actually Snow Leopard or newer
end
alias_method :snow_leopard_or_newer?, :snow_leopard?
def lion?
10.7 <= MACOS_VERSION # Actually Lion or newer
end
alias_method :lion_or_newer?, :lion?
def mountain_lion?
10.8 <= MACOS_VERSION # Actually Mountain Lion or newer
end
alias_method :mountain_lion_or_newer?, :mountain_lion?
end end

View File

@ -63,7 +63,7 @@ private
# Xcode no longer provides autotools or some other build tools # Xcode no longer provides autotools or some other build tools
Dependency.new(spec.to_s) unless MacOS::Xcode.provides_autotools? Dependency.new(spec.to_s) unless MacOS::Xcode.provides_autotools?
when :libpng, :freetype, :pixman, :fontconfig, :cairo when :libpng, :freetype, :pixman, :fontconfig, :cairo
if MacOS.lion_or_newer? if MacOS.version >= :lion
MacOS::XQuartz.installed? ? X11Dependency.new(tag) : Dependency.new(spec.to_s) MacOS::XQuartz.installed? ? X11Dependency.new(tag) : Dependency.new(spec.to_s)
else else
X11Dependency.new(tag) X11Dependency.new(tag)

View File

@ -261,7 +261,7 @@ class SubversionDownloadStrategy < AbstractDownloadStrategy
svncommand = target.exist? ? 'up' : 'checkout' svncommand = target.exist? ? 'up' : 'checkout'
args = [svn, svncommand] args = [svn, svncommand]
# SVN shipped with XCode 3.1.4 can't force a checkout. # SVN shipped with XCode 3.1.4 can't force a checkout.
args << '--force' unless MacOS.leopard? and svn == '/usr/bin/svn' args << '--force' unless MacOS.version == :leopard and svn == '/usr/bin/svn'
args << url if !target.exist? args << url if !target.exist?
args << target args << target
args << '-r' << revision if revision args << '-r' << revision if revision

View File

@ -9,7 +9,7 @@ module HomebrewEnvExtension
delete('CLICOLOR_FORCE') # autotools doesn't like this delete('CLICOLOR_FORCE') # autotools doesn't like this
remove_cc_etc remove_cc_etc
if MacOS.mountain_lion? if MacOS.version >= :mountain_lion
# Fix issue with sed barfing on unicode characters on Mountain Lion. # Fix issue with sed barfing on unicode characters on Mountain Lion.
delete('LC_ALL') delete('LC_ALL')
self['LC_CTYPE']="C" self['LC_CTYPE']="C"

View File

@ -8,16 +8,11 @@ module MacOS extend self
end end
def cat def cat
if mountain_lion? if version == :mountain_lion then :mountainlion
:mountainlion elsif version == :lion then :lion
elsif lion? elsif version == :snow_leopard then :snowleopard
:lion elsif version == :leopard then :leopard
elsif snow_leopard? else nil
:snowleopard
elsif leopard?
:leopard
else
nil
end end
end end
@ -200,27 +195,8 @@ module MacOS extend self
false false
end end
def leopard?
10.5 == MACOS_VERSION
end
def snow_leopard?
10.6 <= MACOS_VERSION # Actually Snow Leopard or newer
end
alias :snow_leopard_or_newer? :snow_leopard?
def lion?
10.7 <= MACOS_VERSION # Actually Lion or newer
end
alias :lion_or_newer? :lion?
def mountain_lion?
10.8 <= MACOS_VERSION # Actually Mountain Lion or newer
end
alias :mountain_lion_or_newer? :mountain_lion?
def prefer_64_bit? def prefer_64_bit?
Hardware.is_64_bit? and not leopard? Hardware.is_64_bit? and version != :leopard
end end
StandardCompilers = { StandardCompilers = {