diff options
| author | Mike McQuaid | 2016-12-10 13:04:14 +0000 |
|---|---|---|
| committer | Mike McQuaid | 2016-12-10 13:04:14 +0000 |
| commit | 598c5e36f910d2e14bb77fd3ae5c2f0155e156bd (patch) | |
| tree | 9d0dba067393d0f1c5125afab1d3945bd4c88bd3 | |
| parent | f02491180b199c370d1f930eb6fa50326e14348a (diff) | |
| download | brew-598c5e36f910d2e14bb77fd3ae5c2f0155e156bd.tar.bz2 | |
Tell people to report URL/tap deprecations to the tap.
Rather than Homebrew/brew or Homebrew/homebrew-core.
| -rw-r--r-- | Library/Homebrew/brew.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/exceptions.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/formulary.rb | 12 |
3 files changed, 23 insertions, 1 deletions
diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index ac35feee8..ba43e65c4 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -138,6 +138,14 @@ rescue RuntimeError, SystemCallError => e onoe e $stderr.puts e.backtrace if ARGV.debug? exit 1 +rescue MethodDeprecatedError => e + Utils::Analytics.report_exception(e) + onoe e + if e.issues_url + $stderr.puts "If reporting this issue please do so at (not Homebrew/brew or Homebrew/core):" + $stderr.puts " #{Formatter.url(e.issues_url)}" + end + exit 1 rescue Exception => e Utils::Analytics.report_exception(e) onoe e diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index c2b78f878..c5d888d64 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -56,7 +56,9 @@ end class FormulaSpecificationError < StandardError; end -class MethodDeprecatedError < StandardError; end +class MethodDeprecatedError < StandardError + attr_accessor :issues_url +end class FormulaUnavailableError < RuntimeError attr_reader :name diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb index 772f4c902..01edcc072 100644 --- a/Library/Homebrew/formulary.rb +++ b/Library/Homebrew/formulary.rb @@ -151,6 +151,11 @@ class Formulary FileUtils.rm_f(path) curl url, "-o", path super + rescue MethodDeprecatedError => e + if url =~ %r{github.com/([\w-]+)/homebrew-([\w-]+)/} + e.issues_url = "https://github.com/#{$1}/homebrew-#{$2}/issues/new" + end + raise end end @@ -202,6 +207,13 @@ class Formulary rescue FormulaUnavailableError => e raise TapFormulaUnavailableError.new(tap, name), "", e.backtrace end + + def load_file + super + rescue MethodDeprecatedError => e + e.issues_url = formula.tap.issues_url || formula.tap.to_s + raise + end end class NullLoader < FormulaLoader |
