aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorVlad Shablinsky2015-08-09 15:08:12 +0300
committerMike McQuaid2015-08-10 13:57:59 +0100
commitab1164f4de48fda5e380e9e68326ea5a15cba804 (patch)
treea1bd6e7139a1c8baea3f434d70dceaca7f4b8ab6 /Library
parent832c5875b01bf86652f53be1543742907da1febb (diff)
downloadbrew-ab1164f4de48fda5e380e9e68326ea5a15cba804.tar.bz2
exceptions: add TapFormulaWithOldnameAmbiguityError
- TapFormulaWithOldnameAmbiguityError is an exception raised when multiple tap formulae available for given old name
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/exceptions.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb
index d49630e0e..bae941eed 100644
--- a/Library/Homebrew/exceptions.rb
+++ b/Library/Homebrew/exceptions.rb
@@ -86,6 +86,26 @@ class TapFormulaAmbiguityError < RuntimeError
end
end
+class TapFormulaWithOldnameAmbiguityError < RuntimeError
+ attr_reader :name, :possible_tap_newname_formulae, :taps
+
+ def initialize(name, possible_tap_newname_formulae)
+ @name = name
+ @possible_tap_newname_formulae = possible_tap_newname_formulae
+
+ @taps = possible_tap_newname_formulae.map do |newname|
+ newname =~ HOMEBREW_TAP_FORMULA_REGEX
+ "#{$1}/#{$2}"
+ end
+
+ super <<-EOS.undent
+ Formulae with '#{name}' old name found in multiple taps: #{taps.map { |t| "\n * #{t}" }.join}
+
+ Please use the fully-qualified name e.g. #{taps.first}/#{name} to refer the formula or use its new name.
+ EOS
+ end
+end
+
class TapUnavailableError < RuntimeError
attr_reader :name