Add audit warning if previous Cask version cannot be read.
This commit is contained in:
		
							parent
							
								
									700300a76b
								
							
						
					
					
						commit
						d9a474ed0e
					
				@ -70,12 +70,16 @@ module Hbc
 | 
			
		||||
      previous_cask_contents = Git.last_revision_of_file(tap.path, @cask.sourcefile_path, before_commit: commit_range)
 | 
			
		||||
      return if previous_cask_contents.empty?
 | 
			
		||||
 | 
			
		||||
      begin
 | 
			
		||||
        previous_cask = CaskLoader.load_from_string(previous_cask_contents)
 | 
			
		||||
 | 
			
		||||
        return unless previous_cask.version == cask.version
 | 
			
		||||
        return if previous_cask.sha256 == cask.sha256
 | 
			
		||||
 | 
			
		||||
        add_error "only sha256 changed (see: https://github.com/caskroom/homebrew-cask/blob/master/doc/cask_language_reference/stanzas/sha256.md)"
 | 
			
		||||
      rescue CaskError => e
 | 
			
		||||
        add_warning "Skipped version and checksum comparison. Reading previous version failed: #{e}"
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    def check_version
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user