Merge pull request #1732 from zmwangx/hint-migrations
Hint at new location of migrated formulae
This commit is contained in:
commit
4117d198cc
@ -1,92 +0,0 @@
|
|||||||
def blacklisted?(name)
|
|
||||||
case name.downcase
|
|
||||||
when "gem", /^rubygems?$/ then <<-EOS.undent
|
|
||||||
Homebrew provides gem via: `brew install ruby`.
|
|
||||||
EOS
|
|
||||||
when "tex", "tex-live", "texlive", "latex" then <<-EOS.undent
|
|
||||||
Installing TeX from source is weird and gross, requires a lot of patches,
|
|
||||||
and only builds 32-bit (and thus can't use Homebrew dependencies)
|
|
||||||
|
|
||||||
We recommend using a MacTeX distribution: https://www.tug.org/mactex/
|
|
||||||
|
|
||||||
You can install it with Homebrew-Cask:
|
|
||||||
brew cask install mactex
|
|
||||||
EOS
|
|
||||||
when "pip" then <<-EOS.undent
|
|
||||||
Homebrew provides pip via: `brew install python`. However you will then
|
|
||||||
have two Pythons installed on your Mac, so alternatively you can install
|
|
||||||
pip via the instructions at:
|
|
||||||
#{Formatter.url("https://pip.readthedocs.io/en/stable/installing/")}
|
|
||||||
EOS
|
|
||||||
when "pil" then <<-EOS.undent
|
|
||||||
Instead of PIL, consider `pip install pillow` or `brew install Homebrew/python/pillow`.
|
|
||||||
EOS
|
|
||||||
when "macruby" then <<-EOS.undent
|
|
||||||
MacRuby is not packaged and is on an indefinite development hiatus.
|
|
||||||
You can read more about it at:
|
|
||||||
#{Formatter.url("https://github.com/MacRuby/MacRuby")}
|
|
||||||
EOS
|
|
||||||
when /(lib)?lzma/
|
|
||||||
"lzma is now part of the xz formula."
|
|
||||||
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.
|
|
||||||
EOS
|
|
||||||
when "gmock", "googlemock", "google-mock" then <<-EOS.undent
|
|
||||||
Installing gmock system-wide is not recommended; it should be vendored
|
|
||||||
in your projects that use it.
|
|
||||||
EOS
|
|
||||||
when "sshpass" then <<-EOS.undent
|
|
||||||
We won't add sshpass because it makes it too easy for novice SSH users to
|
|
||||||
ruin SSH's security.
|
|
||||||
EOS
|
|
||||||
when "gsutil" then <<-EOS.undent
|
|
||||||
Install gsutil with `pip install gsutil`
|
|
||||||
EOS
|
|
||||||
when "clojure" then <<-EOS.undent
|
|
||||||
Clojure isn't really a program but a library managed as part of a
|
|
||||||
project and Leiningen is the user interface to that library.
|
|
||||||
|
|
||||||
To install Clojure you should install Leiningen:
|
|
||||||
brew install leiningen
|
|
||||||
and then follow the tutorial:
|
|
||||||
#{Formatter.url("https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md")}
|
|
||||||
EOS
|
|
||||||
when "osmium" then <<-EOS.undent
|
|
||||||
The creator of Osmium requests that it not be packaged and that people
|
|
||||||
use the GitHub master branch instead.
|
|
||||||
EOS
|
|
||||||
when "gfortran" then <<-EOS.undent
|
|
||||||
GNU Fortran is now provided as part of GCC, and can be installed with:
|
|
||||||
brew install gcc
|
|
||||||
EOS
|
|
||||||
when "play" then <<-EOS.undent
|
|
||||||
Play 2.3 replaces the play command with activator:
|
|
||||||
brew install typesafe-activator
|
|
||||||
|
|
||||||
You can read more about this change at:
|
|
||||||
#{Formatter.url("https://www.playframework.com/documentation/2.3.x/Migration23")}
|
|
||||||
#{Formatter.url("https://www.playframework.com/documentation/2.3.x/Highlights23")}
|
|
||||||
EOS
|
|
||||||
when "haskell-platform" then <<-EOS.undent
|
|
||||||
We no longer package haskell-platform. Consider installing ghc
|
|
||||||
and cabal-install instead:
|
|
||||||
brew install ghc cabal-install
|
|
||||||
|
|
||||||
You can install with Homebrew-Cask:
|
|
||||||
brew cask install haskell-platform
|
|
||||||
EOS
|
|
||||||
when "mysqldump-secure" then <<-EOS.undent
|
|
||||||
The creator of mysqldump-secure tried to game our popularity metrics.
|
|
||||||
EOS
|
|
||||||
when "ngrok" then <<-EOS.undent
|
|
||||||
Upstream sunsetted 1.x in March 2016 and 2.x is not open-source.
|
|
||||||
|
|
||||||
If you wish to use the 2.x release you can install with Homebrew-Cask:
|
|
||||||
brew cask install ngrok
|
|
||||||
EOS
|
|
||||||
end
|
|
||||||
end
|
|
||||||
alias generic_blacklisted? blacklisted?
|
|
||||||
|
|
||||||
require "extend/os/blacklist"
|
|
||||||
@ -16,7 +16,7 @@
|
|||||||
#: See the docs for examples of using the JSON output:
|
#: See the docs for examples of using the JSON output:
|
||||||
#: <http://docs.brew.sh/Querying-Brew.html>
|
#: <http://docs.brew.sh/Querying-Brew.html>
|
||||||
|
|
||||||
require "blacklist"
|
require "missing_formula"
|
||||||
require "caveats"
|
require "caveats"
|
||||||
require "options"
|
require "options"
|
||||||
require "formula"
|
require "formula"
|
||||||
@ -54,10 +54,13 @@ module Homebrew
|
|||||||
else
|
else
|
||||||
info_formula Formulary.find_with_priority(f)
|
info_formula Formulary.find_with_priority(f)
|
||||||
end
|
end
|
||||||
rescue FormulaUnavailableError
|
rescue FormulaUnavailableError => e
|
||||||
# No formula with this name, try a blacklist lookup
|
# No formula with this name, try a missing formula lookup
|
||||||
raise unless (blacklist = blacklisted?(f))
|
if (reason = Homebrew::MissingFormula.reason(f))
|
||||||
puts blacklist
|
ofail "#{e.message}\n#{reason}"
|
||||||
|
else
|
||||||
|
ofail e.message
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -55,7 +55,7 @@
|
|||||||
#: If `--git` is passed, Homebrew will create a Git repository, useful for
|
#: If `--git` is passed, Homebrew will create a Git repository, useful for
|
||||||
#: creating patches to the software.
|
#: creating patches to the software.
|
||||||
|
|
||||||
require "blacklist"
|
require "missing_formula"
|
||||||
require "diagnostic"
|
require "diagnostic"
|
||||||
require "cmd/search"
|
require "cmd/search"
|
||||||
require "formula_installer"
|
require "formula_installer"
|
||||||
@ -206,12 +206,13 @@ module Homebrew
|
|||||||
# formula was found, but there's a problem with its implementation).
|
# formula was found, but there's a problem with its implementation).
|
||||||
ofail e.message
|
ofail e.message
|
||||||
rescue FormulaUnavailableError => e
|
rescue FormulaUnavailableError => e
|
||||||
if (blacklist = blacklisted?(e.name))
|
if (reason = Homebrew::MissingFormula.reason(e.name))
|
||||||
ofail "#{e.message}\n#{blacklist}"
|
ofail "#{e.message}\n#{reason}"
|
||||||
elsif e.name == "updog"
|
elsif e.name == "updog"
|
||||||
ofail "What's updog?"
|
ofail "What's updog?"
|
||||||
else
|
else
|
||||||
ofail e.message
|
ofail e.message
|
||||||
|
|
||||||
query = query_regexp(e.name)
|
query = query_regexp(e.name)
|
||||||
|
|
||||||
ohai "Searching for similarly named formulae..."
|
ohai "Searching for similarly named formulae..."
|
||||||
|
|||||||
@ -9,20 +9,32 @@ module Homebrew
|
|||||||
|
|
||||||
def log
|
def log
|
||||||
if ARGV.named.empty?
|
if ARGV.named.empty?
|
||||||
cd HOMEBREW_REPOSITORY
|
git_log HOMEBREW_REPOSITORY
|
||||||
git_log
|
|
||||||
else
|
else
|
||||||
path = Formulary.path(ARGV.named.first)
|
path = Formulary.path(ARGV.named.first)
|
||||||
cd path.dirname # supports taps
|
tap = Tap.from_path(path)
|
||||||
git_log path
|
git_log path.dirname, path, tap
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def git_log(path = nil)
|
def git_log(cd_dir, path = nil, tap = nil)
|
||||||
if File.exist? "#{`git rev-parse --show-toplevel`.chomp}/.git/shallow"
|
cd cd_dir
|
||||||
|
repo = Utils.popen_read("git rev-parse --show-toplevel").chomp
|
||||||
|
if tap
|
||||||
|
name = tap.to_s
|
||||||
|
git_cd = "$(brew --repo #{tap})"
|
||||||
|
elsif cd_dir == HOMEBREW_REPOSITORY
|
||||||
|
name = "Homebrew/brew"
|
||||||
|
git_cd = "$(brew --repo)"
|
||||||
|
else
|
||||||
|
name, git_cd = cd_dir
|
||||||
|
end
|
||||||
|
|
||||||
|
if File.exist? "#{repo}/.git/shallow"
|
||||||
opoo <<-EOS.undent
|
opoo <<-EOS.undent
|
||||||
The git repository is a shallow clone therefore the filtering may be incorrect.
|
#{name} is a shallow clone so only partial output will be shown.
|
||||||
Use `git fetch --unshallow` to get the full repository.
|
To get a full clone run:
|
||||||
|
git -C "#{git_cd}" fetch --unshallow
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
args = ARGV.options_only
|
args = ARGV.options_only
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
#: Search for <text> in the given package manager's list.
|
#: Search for <text> in the given package manager's list.
|
||||||
|
|
||||||
require "formula"
|
require "formula"
|
||||||
require "blacklist"
|
require "missing_formula"
|
||||||
require "utils"
|
require "utils"
|
||||||
require "thread"
|
require "thread"
|
||||||
require "official_taps"
|
require "official_taps"
|
||||||
@ -67,13 +67,12 @@ module Homebrew
|
|||||||
if $stdout.tty?
|
if $stdout.tty?
|
||||||
count = local_results.length + tap_results.length
|
count = local_results.length + tap_results.length
|
||||||
|
|
||||||
if msg = blacklisted?(query)
|
if reason = Homebrew::MissingFormula.reason(query)
|
||||||
if count > 0
|
if count > 0
|
||||||
puts
|
puts
|
||||||
puts "If you meant #{query.inspect} precisely:"
|
puts "If you meant #{query.inspect} specifically:"
|
||||||
puts
|
|
||||||
end
|
end
|
||||||
puts msg
|
puts reason
|
||||||
elsif count.zero?
|
elsif count.zero?
|
||||||
puts "No formula found for #{query.inspect}."
|
puts "No formula found for #{query.inspect}."
|
||||||
begin
|
begin
|
||||||
|
|||||||
@ -38,7 +38,7 @@ require "official_taps"
|
|||||||
require "cmd/search"
|
require "cmd/search"
|
||||||
require "cmd/style"
|
require "cmd/style"
|
||||||
require "date"
|
require "date"
|
||||||
require "blacklist"
|
require "missing_formula"
|
||||||
require "digest"
|
require "digest"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
@ -399,7 +399,7 @@ class FormulaAuditor
|
|||||||
name = formula.name
|
name = formula.name
|
||||||
full_name = formula.full_name
|
full_name = formula.full_name
|
||||||
|
|
||||||
if blacklisted?(name)
|
if Homebrew::MissingFormula.blacklisted_reason(name)
|
||||||
problem "'#{name}' is blacklisted."
|
problem "'#{name}' is blacklisted."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
#: the specified tap.
|
#: the specified tap.
|
||||||
|
|
||||||
require "formula"
|
require "formula"
|
||||||
require "blacklist"
|
require "missing_formula"
|
||||||
require "digest"
|
require "digest"
|
||||||
require "erb"
|
require "erb"
|
||||||
|
|
||||||
@ -73,8 +73,8 @@ module Homebrew
|
|||||||
# Don't allow blacklisted formula, or names that shadow aliases,
|
# Don't allow blacklisted formula, or names that shadow aliases,
|
||||||
# unless --force is specified.
|
# unless --force is specified.
|
||||||
unless ARGV.force?
|
unless ARGV.force?
|
||||||
if msg = blacklisted?(fc.name)
|
if reason = Homebrew::MissingFormula.blacklisted_reason(fc.name)
|
||||||
raise "#{fc.name} is blacklisted for creation.\n#{msg}\nIf you really want to create this formula use --force."
|
raise "#{fc.name} is blacklisted for creation.\n#{reason}\nIf you really want to create this formula use --force."
|
||||||
end
|
end
|
||||||
|
|
||||||
if Formula.aliases.include? fc.name
|
if Formula.aliases.include? fc.name
|
||||||
|
|||||||
@ -1,2 +0,0 @@
|
|||||||
require "blacklist"
|
|
||||||
require "extend/os/mac/blacklist" if OS.mac?
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
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
|
|
||||||
22
Library/Homebrew/extend/os/mac/missing_formula.rb
Normal file
22
Library/Homebrew/extend/os/mac/missing_formula.rb
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
module Homebrew
|
||||||
|
module MissingFormula
|
||||||
|
class << self
|
||||||
|
def blacklisted_reason(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 #{Formatter.url("https://developer.apple.com/xcode/downloads/")}.
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
else
|
||||||
|
generic_blacklisted_reason(name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
2
Library/Homebrew/extend/os/missing_formula.rb
Normal file
2
Library/Homebrew/extend/os/missing_formula.rb
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
require "missing_formula"
|
||||||
|
require "extend/os/mac/missing_formula" if OS.mac?
|
||||||
159
Library/Homebrew/missing_formula.rb
Normal file
159
Library/Homebrew/missing_formula.rb
Normal file
@ -0,0 +1,159 @@
|
|||||||
|
require "formulary"
|
||||||
|
require "tap"
|
||||||
|
require "utils"
|
||||||
|
|
||||||
|
module Homebrew
|
||||||
|
module MissingFormula
|
||||||
|
class << self
|
||||||
|
def reason(name)
|
||||||
|
blacklisted_reason(name) || tap_migration_reason(name) || deleted_reason(name)
|
||||||
|
end
|
||||||
|
|
||||||
|
def blacklisted_reason(name)
|
||||||
|
case name.downcase
|
||||||
|
when "gem", /^rubygems?$/ then <<-EOS.undent
|
||||||
|
Homebrew provides gem via: `brew install ruby`.
|
||||||
|
EOS
|
||||||
|
when "tex", "tex-live", "texlive", "latex" then <<-EOS.undent
|
||||||
|
Installing TeX from source is weird and gross, requires a lot of patches,
|
||||||
|
and only builds 32-bit (and thus can't use Homebrew dependencies)
|
||||||
|
|
||||||
|
We recommend using a MacTeX distribution: https://www.tug.org/mactex/
|
||||||
|
|
||||||
|
You can install it with Homebrew-Cask:
|
||||||
|
brew cask install mactex
|
||||||
|
EOS
|
||||||
|
when "pip" then <<-EOS.undent
|
||||||
|
Homebrew provides pip via: `brew install python`. However you will then
|
||||||
|
have two Pythons installed on your Mac, so alternatively you can install
|
||||||
|
pip via the instructions at:
|
||||||
|
#{Formatter.url("https://pip.readthedocs.io/en/stable/installing/")}
|
||||||
|
EOS
|
||||||
|
when "pil" then <<-EOS.undent
|
||||||
|
Instead of PIL, consider `pip install pillow` or `brew install Homebrew/python/pillow`.
|
||||||
|
EOS
|
||||||
|
when "macruby" then <<-EOS.undent
|
||||||
|
MacRuby is not packaged and is on an indefinite development hiatus.
|
||||||
|
You can read more about it at:
|
||||||
|
#{Formatter.url("https://github.com/MacRuby/MacRuby")}
|
||||||
|
EOS
|
||||||
|
when /(lib)?lzma/
|
||||||
|
"lzma is now part of the xz formula."
|
||||||
|
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.
|
||||||
|
EOS
|
||||||
|
when "gmock", "googlemock", "google-mock" then <<-EOS.undent
|
||||||
|
Installing gmock system-wide is not recommended; it should be vendored
|
||||||
|
in your projects that use it.
|
||||||
|
EOS
|
||||||
|
when "sshpass" then <<-EOS.undent
|
||||||
|
We won't add sshpass because it makes it too easy for novice SSH users to
|
||||||
|
ruin SSH's security.
|
||||||
|
EOS
|
||||||
|
when "gsutil" then <<-EOS.undent
|
||||||
|
Install gsutil with `pip install gsutil`
|
||||||
|
EOS
|
||||||
|
when "clojure" then <<-EOS.undent
|
||||||
|
Clojure isn't really a program but a library managed as part of a
|
||||||
|
project and Leiningen is the user interface to that library.
|
||||||
|
|
||||||
|
To install Clojure you should install Leiningen:
|
||||||
|
brew install leiningen
|
||||||
|
and then follow the tutorial:
|
||||||
|
#{Formatter.url("https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md")}
|
||||||
|
EOS
|
||||||
|
when "osmium" then <<-EOS.undent
|
||||||
|
The creator of Osmium requests that it not be packaged and that people
|
||||||
|
use the GitHub master branch instead.
|
||||||
|
EOS
|
||||||
|
when "gfortran" then <<-EOS.undent
|
||||||
|
GNU Fortran is now provided as part of GCC, and can be installed with:
|
||||||
|
brew install gcc
|
||||||
|
EOS
|
||||||
|
when "play" then <<-EOS.undent
|
||||||
|
Play 2.3 replaces the play command with activator:
|
||||||
|
brew install typesafe-activator
|
||||||
|
|
||||||
|
You can read more about this change at:
|
||||||
|
#{Formatter.url("https://www.playframework.com/documentation/2.3.x/Migration23")}
|
||||||
|
#{Formatter.url("https://www.playframework.com/documentation/2.3.x/Highlights23")}
|
||||||
|
EOS
|
||||||
|
when "haskell-platform" then <<-EOS.undent
|
||||||
|
We no longer package haskell-platform. Consider installing ghc
|
||||||
|
and cabal-install instead:
|
||||||
|
brew install ghc cabal-install
|
||||||
|
|
||||||
|
You can install with Homebrew-Cask:
|
||||||
|
brew cask install haskell-platform
|
||||||
|
EOS
|
||||||
|
when "mysqldump-secure" then <<-EOS.undent
|
||||||
|
The creator of mysqldump-secure tried to game our popularity metrics.
|
||||||
|
EOS
|
||||||
|
when "ngrok" then <<-EOS.undent
|
||||||
|
Upstream sunsetted 1.x in March 2016 and 2.x is not open-source.
|
||||||
|
|
||||||
|
If you wish to use the 2.x release you can install with Homebrew-Cask:
|
||||||
|
brew cask install ngrok
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
end
|
||||||
|
alias generic_blacklisted_reason blacklisted_reason
|
||||||
|
|
||||||
|
def tap_migration_reason(name)
|
||||||
|
message = nil
|
||||||
|
|
||||||
|
Tap.each do |old_tap|
|
||||||
|
new_tap_name = old_tap.tap_migrations[name]
|
||||||
|
next unless new_tap_name
|
||||||
|
message = <<-EOS.undent
|
||||||
|
It was migrated from #{old_tap} to #{new_tap_name}.
|
||||||
|
You can access it again by running:
|
||||||
|
brew tap #{new_tap_name}
|
||||||
|
EOS
|
||||||
|
break
|
||||||
|
end
|
||||||
|
|
||||||
|
message
|
||||||
|
end
|
||||||
|
|
||||||
|
def deleted_reason(name)
|
||||||
|
path = Formulary.path name
|
||||||
|
return if File.exist? path
|
||||||
|
tap = Tap.from_path(path)
|
||||||
|
return unless File.exist? tap.path
|
||||||
|
relative_path = path.relative_path_from tap.path
|
||||||
|
|
||||||
|
tap.path.cd do
|
||||||
|
# We know this may return incomplete results for shallow clones but
|
||||||
|
# we don't want to nag everyone with a shallow clone to unshallow it.
|
||||||
|
log_command = "git log --name-only --max-count=1 --format=%H\\\\n%h\\\\n%B -- #{relative_path}"
|
||||||
|
hash, short_hash, *commit_message, relative_path =
|
||||||
|
Utils.popen_read(log_command).gsub("\\n", "\n").lines.map(&:chomp)
|
||||||
|
if hash.to_s.empty? || short_hash.to_s.empty? ||
|
||||||
|
relative_path.to_s.empty?
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
commit_message = commit_message.reject(&:empty?).join("\n ")
|
||||||
|
|
||||||
|
commit_message.sub!(/ \(#(\d+)\)$/, " (#{tap.issues_url}/\\1)")
|
||||||
|
commit_message.gsub!(/(Closes|Fixes) #(\d+)/, "\\1 #{tap.issues_url}/\\2")
|
||||||
|
|
||||||
|
<<-EOS.undent
|
||||||
|
#{name} was deleted from #{tap.name} in commit #{short_hash}:
|
||||||
|
#{commit_message}
|
||||||
|
|
||||||
|
To show the formula before removal run:
|
||||||
|
git -C "$(brew --repo #{tap})" show #{short_hash}^:#{relative_path}
|
||||||
|
|
||||||
|
If you still use this formula consider creating your own tap:
|
||||||
|
http://docs.brew.sh/How-to-Create-and-Maintain-a-Tap.html
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
require "extend/os/missing_formula"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@ -41,6 +41,15 @@ class Tap
|
|||||||
CACHE.fetch(cache_key) { |key| CACHE[key] = Tap.new(user, repo) }
|
CACHE.fetch(cache_key) { |key| CACHE[key] = Tap.new(user, repo) }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def self.from_path(path)
|
||||||
|
path.to_s =~ HOMEBREW_TAP_PATH_REGEX
|
||||||
|
raise "Invalid tap path '#{path}'" unless $1
|
||||||
|
fetch($1, $2)
|
||||||
|
rescue
|
||||||
|
# No need to error as a nil tap is sufficient to show failure.
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
|
||||||
extend Enumerable
|
extend Enumerable
|
||||||
|
|
||||||
# The user name of this {Tap}. Usually, it's the Github username of
|
# The user name of this {Tap}. Usually, it's the Github username of
|
||||||
|
|||||||
@ -1,115 +0,0 @@
|
|||||||
require "blacklist"
|
|
||||||
|
|
||||||
describe "Blacklist" do
|
|
||||||
matcher(:be_blacklisted) { match(&method(:blacklisted?)) }
|
|
||||||
|
|
||||||
context "rubygems" do
|
|
||||||
%w[gem rubygem rubygems].each do |s|
|
|
||||||
subject { s }
|
|
||||||
|
|
||||||
it { is_expected.to be_blacklisted }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "latex" do
|
|
||||||
%w[latex tex tex-live texlive TexLive].each do |s|
|
|
||||||
subject { s }
|
|
||||||
|
|
||||||
it { is_expected.to be_blacklisted }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "pip" do
|
|
||||||
subject { "pip" }
|
|
||||||
|
|
||||||
it { is_expected.to be_blacklisted }
|
|
||||||
end
|
|
||||||
|
|
||||||
context "pil" do
|
|
||||||
subject { "pil" }
|
|
||||||
|
|
||||||
it { is_expected.to be_blacklisted }
|
|
||||||
end
|
|
||||||
|
|
||||||
context "macruby" do
|
|
||||||
subject { "MacRuby" }
|
|
||||||
|
|
||||||
it { is_expected.to be_blacklisted }
|
|
||||||
end
|
|
||||||
|
|
||||||
context "lzma" do
|
|
||||||
%w[lzma liblzma].each do |s|
|
|
||||||
subject { s }
|
|
||||||
|
|
||||||
it { is_expected.to be_blacklisted }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "gtest" do
|
|
||||||
%w[gtest googletest google-test].each do |s|
|
|
||||||
subject { s }
|
|
||||||
|
|
||||||
it { is_expected.to be_blacklisted }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "gmock" do
|
|
||||||
%w[gmock googlemock google-mock].each do |s|
|
|
||||||
subject { s }
|
|
||||||
|
|
||||||
it { is_expected.to be_blacklisted }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "sshpass" do
|
|
||||||
subject { "sshpass" }
|
|
||||||
|
|
||||||
it { is_expected.to be_blacklisted }
|
|
||||||
end
|
|
||||||
|
|
||||||
context "gsutil" do
|
|
||||||
subject { "gsutil" }
|
|
||||||
|
|
||||||
it { is_expected.to be_blacklisted }
|
|
||||||
end
|
|
||||||
|
|
||||||
context "clojure" do
|
|
||||||
subject { "clojure" }
|
|
||||||
|
|
||||||
it { is_expected.to be_blacklisted }
|
|
||||||
end
|
|
||||||
|
|
||||||
context "osmium" do
|
|
||||||
%w[osmium Osmium].each do |s|
|
|
||||||
subject { s }
|
|
||||||
|
|
||||||
it { is_expected.to be_blacklisted }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "gfortran" do
|
|
||||||
subject { "gfortran" }
|
|
||||||
|
|
||||||
it { is_expected.to be_blacklisted }
|
|
||||||
end
|
|
||||||
|
|
||||||
context "play" do
|
|
||||||
subject { "play" }
|
|
||||||
|
|
||||||
it { is_expected.to be_blacklisted }
|
|
||||||
end
|
|
||||||
|
|
||||||
context "haskell-platform" do
|
|
||||||
subject { "haskell-platform" }
|
|
||||||
|
|
||||||
it { is_expected.to be_blacklisted }
|
|
||||||
end
|
|
||||||
|
|
||||||
context "xcode", :needs_macos do
|
|
||||||
%w[xcode Xcode].each do |s|
|
|
||||||
subject { s }
|
|
||||||
|
|
||||||
it { is_expected.to be_blacklisted }
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -33,7 +33,7 @@ describe "brew log", :integration_test do
|
|||||||
|
|
||||||
expect { brew "log", "#{shallow_tap}/testball" }
|
expect { brew "log", "#{shallow_tap}/testball" }
|
||||||
.to output(/This is a test commit for Testball/).to_stdout
|
.to output(/This is a test commit for Testball/).to_stdout
|
||||||
.and output(/Warning: The git repository is a shallow clone/).to_stderr
|
.and output(%r{Warning: homebrew/shallow is a shallow clone}).to_stderr
|
||||||
.and be_a_success
|
.and be_a_success
|
||||||
|
|
||||||
expect(shallow_tap.path/".git/shallow").to exist, "A shallow clone should have been created."
|
expect(shallow_tap.path/".git/shallow").to exist, "A shallow clone should have been created."
|
||||||
|
|||||||
179
Library/Homebrew/test/missing_formula_spec.rb
Normal file
179
Library/Homebrew/test/missing_formula_spec.rb
Normal file
@ -0,0 +1,179 @@
|
|||||||
|
require "missing_formula"
|
||||||
|
|
||||||
|
describe Homebrew::MissingFormula do
|
||||||
|
context "::reason" do
|
||||||
|
subject { described_class.reason("gem") }
|
||||||
|
|
||||||
|
it { is_expected.to_not be_nil }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "::blacklisted_reason" do
|
||||||
|
matcher(:be_blacklisted) do
|
||||||
|
match(&Homebrew::MissingFormula.method(:blacklisted_reason))
|
||||||
|
end
|
||||||
|
|
||||||
|
context "rubygems" do
|
||||||
|
%w[gem rubygem rubygems].each do |s|
|
||||||
|
subject { s }
|
||||||
|
|
||||||
|
it { is_expected.to be_blacklisted }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "latex" do
|
||||||
|
%w[latex tex tex-live texlive TexLive].each do |s|
|
||||||
|
subject { s }
|
||||||
|
|
||||||
|
it { is_expected.to be_blacklisted }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "pip" do
|
||||||
|
subject { "pip" }
|
||||||
|
|
||||||
|
it { is_expected.to be_blacklisted }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "pil" do
|
||||||
|
subject { "pil" }
|
||||||
|
|
||||||
|
it { is_expected.to be_blacklisted }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "macruby" do
|
||||||
|
subject { "MacRuby" }
|
||||||
|
|
||||||
|
it { is_expected.to be_blacklisted }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "lzma" do
|
||||||
|
%w[lzma liblzma].each do |s|
|
||||||
|
subject { s }
|
||||||
|
|
||||||
|
it { is_expected.to be_blacklisted }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "gtest" do
|
||||||
|
%w[gtest googletest google-test].each do |s|
|
||||||
|
subject { s }
|
||||||
|
|
||||||
|
it { is_expected.to be_blacklisted }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "gmock" do
|
||||||
|
%w[gmock googlemock google-mock].each do |s|
|
||||||
|
subject { s }
|
||||||
|
|
||||||
|
it { is_expected.to be_blacklisted }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "sshpass" do
|
||||||
|
subject { "sshpass" }
|
||||||
|
|
||||||
|
it { is_expected.to be_blacklisted }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "gsutil" do
|
||||||
|
subject { "gsutil" }
|
||||||
|
|
||||||
|
it { is_expected.to be_blacklisted }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "clojure" do
|
||||||
|
subject { "clojure" }
|
||||||
|
|
||||||
|
it { is_expected.to be_blacklisted }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "osmium" do
|
||||||
|
%w[osmium Osmium].each do |s|
|
||||||
|
subject { s }
|
||||||
|
|
||||||
|
it { is_expected.to be_blacklisted }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "gfortran" do
|
||||||
|
subject { "gfortran" }
|
||||||
|
|
||||||
|
it { is_expected.to be_blacklisted }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "play" do
|
||||||
|
subject { "play" }
|
||||||
|
|
||||||
|
it { is_expected.to be_blacklisted }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "haskell-platform" do
|
||||||
|
subject { "haskell-platform" }
|
||||||
|
|
||||||
|
it { is_expected.to be_blacklisted }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "xcode", :needs_macos do
|
||||||
|
%w[xcode Xcode].each do |s|
|
||||||
|
subject { s }
|
||||||
|
|
||||||
|
it { is_expected.to be_blacklisted }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "::tap_migration_reason" do
|
||||||
|
subject { described_class.tap_migration_reason(formula) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
Tap.clear_cache
|
||||||
|
tap_path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
|
||||||
|
tap_path.mkpath
|
||||||
|
(tap_path/"tap_migrations.json").write <<-EOS.undent
|
||||||
|
{ "migrated-formula": "homebrew/bar" }
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with a migrated formula" do
|
||||||
|
let(:formula) { "migrated-formula" }
|
||||||
|
it { is_expected.to_not be_nil }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with a missing formula" do
|
||||||
|
let(:formula) { "missing-formula" }
|
||||||
|
it { is_expected.to be_nil }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "::deleted_reason" do
|
||||||
|
subject { described_class.deleted_reason(formula) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
Tap.clear_cache
|
||||||
|
tap_path = Tap::TAP_DIRECTORY/"homebrew/homebrew-foo"
|
||||||
|
tap_path.mkpath
|
||||||
|
(tap_path/"deleted-formula.rb").write "placeholder"
|
||||||
|
|
||||||
|
tap_path.cd do
|
||||||
|
shutup do
|
||||||
|
system "git", "init"
|
||||||
|
system "git", "add", "--all"
|
||||||
|
system "git", "commit", "-m", "initial state"
|
||||||
|
system "git", "rm", "deleted-formula.rb"
|
||||||
|
system "git", "commit", "-m", "delete formula 'deleted-formula'"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with a deleted formula" do
|
||||||
|
let(:formula) { "homebrew/foo/deleted-formula" }
|
||||||
|
it { is_expected.to_not be_nil }
|
||||||
|
end
|
||||||
|
|
||||||
|
context "with a formula that never existed" do
|
||||||
|
let(:formula) { "homebrew/foo/missing-formula" }
|
||||||
|
it { is_expected.to be_nil }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user