diff --git a/Library/Homebrew/blacklist.rb b/Library/Homebrew/blacklist.rb index e9e67cb752..4312d0bf3b 100644 --- a/Library/Homebrew/blacklist.rb +++ b/Library/Homebrew/blacklist.rb @@ -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" diff --git a/Library/Homebrew/extend/os/blacklist.rb b/Library/Homebrew/extend/os/blacklist.rb new file mode 100644 index 0000000000..f72c7c6438 --- /dev/null +++ b/Library/Homebrew/extend/os/blacklist.rb @@ -0,0 +1,5 @@ +require "blacklist" + +if OS.mac? + require "extend/os/mac/blacklist" +end diff --git a/Library/Homebrew/extend/os/mac/blacklist.rb b/Library/Homebrew/extend/os/mac/blacklist.rb new file mode 100644 index 0000000000..edff4697e7 --- /dev/null +++ b/Library/Homebrew/extend/os/mac/blacklist.rb @@ -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 diff --git a/Library/Homebrew/test/test_blacklist.rb b/Library/Homebrew/test/test_blacklist.rb index f700f361bc..585a354844 100644 --- a/Library/Homebrew/test/test_blacklist.rb +++ b/Library/Homebrew/test/test_blacklist.rb @@ -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 diff --git a/Library/Homebrew/test/test_os_mac_blacklist.rb b/Library/Homebrew/test/test_os_mac_blacklist.rb new file mode 100644 index 0000000000..e5becc9d22 --- /dev/null +++ b/Library/Homebrew/test/test_os_mac_blacklist.rb @@ -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