formula_installer: move deprecation/disabled checking earlier

This commit is contained in:
Bo Anderson 2021-03-24 15:46:29 +00:00
parent a59d07760f
commit 929d2d8caf
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65

View File

@ -179,6 +179,24 @@ class FormulaInstaller
sig { void }
def prelude
type, reason = DeprecateDisable.deprecate_disable_info formula
if type.present?
case type
when :deprecated
if reason.present?
opoo "#{formula.full_name} has been deprecated because it #{reason}!"
else
opoo "#{formula.full_name} has been deprecated!"
end
when :disabled
if reason.present?
raise CannotInstallFormulaError, "#{formula.full_name} has been disabled because it #{reason}!"
end
raise CannotInstallFormulaError, "#{formula.full_name} has been disabled!"
end
end
Tab.clear_cache
verify_deps_exist unless ignore_deps?
forbidden_license_check
@ -248,25 +266,6 @@ class FormulaInstaller
end
end
type, reason = DeprecateDisable.deprecate_disable_info formula
if type.present?
case type
when :deprecated
if reason.present?
opoo "#{formula.full_name} has been deprecated because it #{reason}!"
else
opoo "#{formula.full_name} has been deprecated!"
end
when :disabled
if reason.present?
raise CannotInstallFormulaError, "#{formula.full_name} has been disabled because it #{reason}!"
end
raise CannotInstallFormulaError, "#{formula.full_name} has been disabled!"
end
end
return if ignore_deps?
if Homebrew::EnvConfig.developer?