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)
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
def check_gitlab_repository_archived
@ -504,7 +512,15 @@ module Cask
metadata = SharedAudits.gitlab_repo_data(user, repo)
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
def check_github_repository

View File

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

View File

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