2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-03-18 17:02:08 +02:00
|
|
|
module Homebrew
|
|
|
|
module MissingFormula
|
|
|
|
class << self
|
|
|
|
def blacklisted_reason(name)
|
|
|
|
case name.downcase
|
|
|
|
when "xcode"
|
2019-01-26 17:13:14 +00:00
|
|
|
<<~EOS
|
|
|
|
Xcode can be installed from the App Store.
|
|
|
|
EOS
|
2017-03-18 17:02:08 +02:00
|
|
|
else
|
|
|
|
generic_blacklisted_reason(name)
|
|
|
|
end
|
|
|
|
end
|
2019-05-21 07:12:09 +01:00
|
|
|
|
|
|
|
def cask_reason(name, silent: false, show_info: false)
|
|
|
|
return if silent
|
|
|
|
|
|
|
|
cask = Cask::CaskLoader.load(name)
|
|
|
|
reason = +"Found a cask named \"#{name}\" instead.\n"
|
2019-06-21 00:09:08 -04:00
|
|
|
if show_info
|
|
|
|
reason << Cask::Cmd::Info.get_info(cask)
|
|
|
|
else
|
|
|
|
reason << "Did you mean to type \"brew cask install #{name}\"?\n"
|
|
|
|
end
|
2019-05-21 07:12:09 +01:00
|
|
|
reason.freeze
|
|
|
|
rescue Cask::CaskUnavailableError
|
|
|
|
nil
|
|
|
|
end
|
2017-03-18 17:02:08 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|