Merge pull request #9078 from reitermarkus/discontinued-casks
Only warn if repo of discontinued cask is archived.
This commit is contained in:
		
						commit
						85d6fa809f
					
				@ -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
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
@ -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.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user