diff --git a/Library/Homebrew/cask/installer.rb b/Library/Homebrew/cask/installer.rb index 45383d30ec728..494193a252bc2 100644 --- a/Library/Homebrew/cask/installer.rb +++ b/Library/Homebrew/cask/installer.rb @@ -127,11 +127,12 @@ def install def check_deprecate_disable deprecate_disable_type = DeprecateDisable.type(@cask) - return if deprecate_disable_type.blank? + return if deprecate_disable_type.nil? - if deprecate_disable_type == :deprecated + case deprecate_disable_type + when :deprecated opoo "#{@cask.token} has been #{DeprecateDisable.message(@cask)}" - elsif deprecate_disable_type == :disabled + when :disabled raise CaskCannotBeInstalledError.new(@cask, DeprecateDisable.message(@cask)) end end diff --git a/Library/Homebrew/deprecate_disable.rb b/Library/Homebrew/deprecate_disable.rb index adc3801cfa70e..55d6a24add6a9 100644 --- a/Library/Homebrew/deprecate_disable.rb +++ b/Library/Homebrew/deprecate_disable.rb @@ -7,11 +7,6 @@ module DeprecateDisable module_function - SHARED_DEPRECATE_DISABLE_REASONS = { - repo_archived: "has an archived upstream repository", - repo_removed: "has a removed upstream repository", - }.freeze - FORMULA_DEPRECATE_DISABLE_REASONS = { does_not_build: "does not build", no_license: "has no license", @@ -25,19 +20,16 @@ module DeprecateDisable "a different checksum than the current one. " \ "Upstream's repository might have been compromised. " \ "We can re-package this once upstream has confirmed that they retagged their release", - **SHARED_DEPRECATE_DISABLE_REASONS, }.freeze CASK_DEPRECATE_DISABLE_REASONS = { - discontinued: "is discontinued upstream", - unsigned_artifact: "has an unsigned binary which prevents it from running on Apple Silicon devices " \ - "under standard macOS security policy", - **SHARED_DEPRECATE_DISABLE_REASONS, + discontinued: "is discontinued upstream", }.freeze def type(formula_or_cask) return :deprecated if formula_or_cask.deprecated? - return :disabled if formula_or_cask.disabled? + + :disabled if formula_or_cask.disabled? end def message(formula_or_cask) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 9b46b15d02e8f..dd8a0e450ec89 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -204,9 +204,10 @@ def prelude if deprecate_disable_type.present? message = "#{formula.full_name} has been #{DeprecateDisable.message(formula)}" - if deprecate_disable_type == :deprecated + case deprecate_disable_type + when :deprecated opoo message - elsif deprecate_disable_type == :disabled + when :disabled raise CannotInstallFormulaError, message end end