Skip to content

Commit

Permalink
Apply feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Rylan12 committed Dec 17, 2023
1 parent 472dd95 commit 6431822
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
7 changes: 4 additions & 3 deletions Library/Homebrew/cask/installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 3 additions & 11 deletions Library/Homebrew/deprecate_disable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions Library/Homebrew/formula_installer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6431822

Please sign in to comment.