Only warn if repo of discontinued cask is archived.

This commit is contained in:
Markus Reiter 2020-11-07 21:29:06 +01:00
parent fd47fd8fb4
commit d66ca60cdb
3 changed files with 29 additions and 2 deletions

View File

@ -492,7 +492,15 @@ module Cask
metadata = SharedAudits.github_repo_data(user, repo) metadata = SharedAudits.github_repo_data(user, repo)
return if metadata.nil? return if metadata.nil?
add_error "GitHub repo is archived" if metadata["archived"] return unless metadata["archived"]
message = "GitHub repo is archived"
if cask.discontinued?
add_warning message
else
add_error message
end
end end
def check_gitlab_repository_archived def check_gitlab_repository_archived
@ -504,7 +512,15 @@ module Cask
metadata = SharedAudits.gitlab_repo_data(user, repo) metadata = SharedAudits.gitlab_repo_data(user, repo)
return if metadata.nil? return if metadata.nil?
add_error "GitLab repo is archived" if metadata["archived"] return unless metadata["archived"]
message = "GitLab repo is archived"
if cask.discontinued?
add_warning message
else
add_error message
end
end end
def check_github_repository def check_github_repository

View File

@ -80,6 +80,7 @@ module Cask
:url, :url,
:version, :version,
:appdir, :appdir,
:discontinued?,
*ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key), *ORDINARY_ARTIFACT_CLASSES.map(&:dsl_key),
*ACTIVATABLE_ARTIFACT_CLASSES.map(&:dsl_key), *ACTIVATABLE_ARTIFACT_CLASSES.map(&:dsl_key),
*ARTIFACT_BLOCK_CLASSES.flat_map { |klass| [klass.dsl_key, klass.uninstall_dsl_key] }, *ARTIFACT_BLOCK_CLASSES.flat_map { |klass| [klass.dsl_key, klass.uninstall_dsl_key] },
@ -259,6 +260,10 @@ module Cask
@caveats @caveats
end end
def discontinued?
@caveats&.discontinued?
end
def auto_updates(auto_updates = nil) def auto_updates(auto_updates = nil)
set_unique_stanza(:auto_updates, auto_updates.nil?) { auto_updates } set_unique_stanza(:auto_updates, auto_updates.nil?) { auto_updates }
end end

View File

@ -15,10 +15,15 @@ module Cask
# #
# @api private # @api private
class Caveats < Base class Caveats < Base
extend Predicable
attr_predicate :discontinued?
def initialize(*args) def initialize(*args)
super(*args) super(*args)
@built_in_caveats = {} @built_in_caveats = {}
@custom_caveats = [] @custom_caveats = []
@discontinued = false
end end
def self.caveat(name, &block) def self.caveat(name, &block)
@ -135,6 +140,7 @@ module Cask
end end
caveat :discontinued do caveat :discontinued do
@discontinued = true
<<~EOS <<~EOS
#{@cask} has been officially discontinued upstream. #{@cask} has been officially discontinued upstream.
It may stop working correctly (or at all) in recent versions of macOS. It may stop working correctly (or at all) in recent versions of macOS.