diff --git a/Library/Homebrew/formula_versions.rb b/Library/Homebrew/formula_versions.rb index de285b642d..13cb8ac8c4 100644 --- a/Library/Homebrew/formula_versions.rb +++ b/Library/Homebrew/formula_versions.rb @@ -34,6 +34,7 @@ class FormulaVersions contents = file_contents_at_revision(rev) begin + Homebrew.raise_deprecation_exceptions = true nostdout { yield Formulary.from_contents(name, path, contents) } rescue *IGNORED_EXCEPTIONS => e # We rescue these so that we can skip bad versions and @@ -41,6 +42,8 @@ class FormulaVersions ohai "#{e} in #{name} at revision #{rev}", e.backtrace if ARGV.debug? rescue FormulaUnavailableError # Suppress this error + ensure + Homebrew.raise_deprecation_exceptions = false end end diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index 9554dd536f..f739f5012b 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -51,6 +51,9 @@ module Homebrew attr_accessor :failed alias_method :failed?, :failed + + attr_accessor :raise_deprecation_exceptions + alias_method :raise_deprecation_exceptions?, :raise_deprecation_exceptions end HOMEBREW_PULL_API_REGEX = %r{https://api\.github\.com/repos/([\w-]+)/([\w-]+)?/pulls/(\d+)} diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 71f03c6d50..90469bca92 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -151,7 +151,8 @@ def odeprecated(method, replacement = nil, options = {}) #{caller_message}#{tap_message} EOS - if ARGV.homebrew_developer? || options[:die] + if ARGV.homebrew_developer? || options[:die] || + Homebrew.raise_deprecation_exceptions? raise FormulaMethodDeprecatedError, message else opoo "#{message}\n"