aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/exceptions.rb
diff options
context:
space:
mode:
authorXu Cheng2015-05-08 19:16:06 +0800
committerXu Cheng2015-05-27 13:53:40 +0800
commit811c4c5add5048e2e67814045e6d5fbb7820ddcb (patch)
tree6e4c866b1f11a788c0988e7402d9d223c24e2bb3 /Library/Homebrew/exceptions.rb
parent3a3a49bd93ee3a5a39019bb972a2a851ba2ab2f6 (diff)
downloadbrew-811c4c5add5048e2e67814045e6d5fbb7820ddcb.tar.bz2
load tap formula through direct search
Diffstat (limited to 'Library/Homebrew/exceptions.rb')
-rw-r--r--Library/Homebrew/exceptions.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb
index 663236cba..28a97bc82 100644
--- a/Library/Homebrew/exceptions.rb
+++ b/Library/Homebrew/exceptions.rb
@@ -65,6 +65,25 @@ class TapFormulaUnavailableError < FormulaUnavailableError
end
end
+class TapFormulaAmbiguityError < RuntimeError
+ attr_reader :name, :paths, :formulae
+
+ def initialize name, paths
+ @name = name
+ @paths = paths
+ @formulae = paths.map do |path|
+ path.to_s =~ HOMEBREW_TAP_PATH_REGEX
+ "#{$1}/#{$2.sub("homebrew-", "")}/#{path.basename(".rb")}"
+ end
+
+ super <<-EOS.undent
+ Formulae found in multiple taps: #{formulae.map { |f| "\n * #{f}" }.join}
+
+ Please use the fully-qualified name e.g. #{formulae.first} to refer the formula.
+ EOS
+ end
+end
+
class OperationInProgressError < RuntimeError
def initialize name
message = <<-EOS.undent