blacklist: port to generic layer.

This commit is contained in:
Mike McQuaid 2016-07-16 21:02:16 +01:00
parent c186d39289
commit c86c600bfd
5 changed files with 36 additions and 14 deletions

View File

@ -28,16 +28,6 @@ def blacklisted?(name)
EOS
when /(lib)?lzma/
"lzma is now part of the xz formula."
when "xcode"
if MacOS.version >= :lion
<<-EOS.undent
Xcode can be installed from the App Store.
EOS
else
<<-EOS.undent
Xcode can be installed from https://developer.apple.com/xcode/downloads/
EOS
end
when "gtest", "googletest", "google-test" then <<-EOS.undent
Installing gtest system-wide is not recommended; it should be vendored
in your projects that use it.
@ -97,3 +87,6 @@ def blacklisted?(name)
EOS
end
end
alias generic_blacklisted? blacklisted?
require "extend/os/blacklist"

View File

@ -0,0 +1,5 @@
require "blacklist"
if OS.mac?
require "extend/os/mac/blacklist"
end

View File

@ -0,0 +1,16 @@
def blacklisted?(name)
case name.downcase
when "xcode"
if MacOS.version >= :lion
<<-EOS.undent
Xcode can be installed from the App Store.
EOS
else
<<-EOS.undent
Xcode can be installed from https://developer.apple.com/xcode/downloads/
EOS
end
else
generic_blacklisted?(name)
end
end

View File

@ -30,10 +30,6 @@ class BlacklistTests < Homebrew::TestCase
%w[lzma liblzma].each { |s| assert_blacklisted s }
end
def test_xcode
%w[xcode Xcode].each { |s| assert_blacklisted s }
end
def test_gtest
%w[gtest googletest google-test].each { |s| assert_blacklisted s }
end

View File

@ -0,0 +1,12 @@
require "testing_env"
require "blacklist"
class BlacklistTests < Homebrew::TestCase
def assert_blacklisted(s)
assert blacklisted?(s), "'#{s}' should be blacklisted"
end
def test_xcode
%w[xcode Xcode].each { |s| assert_blacklisted s }
end
end