Apply feedback

This commit is contained in:
Rylan Polster 2023-12-16 20:08:42 -05:00
parent 472dd95b16
commit 6431822e7b
No known key found for this signature in database
GPG Key ID: 46A744940CFF4D64
3 changed files with 10 additions and 16 deletions

View File

@ -127,11 +127,12 @@ on_request: true)
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

View File

@ -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)

View File

@ -204,9 +204,10 @@ class FormulaInstaller
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