Merge pull request #10927 from Bo98/fi-deprecated-disabled

formula_installer: move deprecation/disabled checking earlier
This commit is contained in:
Bo Anderson 2021-03-25 18:29:24 +00:00 committed by GitHub
commit 679dbea79f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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?