Class: Cask::Auditor Private

Inherits:
Object
  • Object
show all
Defined in:
Library/Homebrew/cask/auditor.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Helper class for auditing all available languages of a cask.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cask, audit_download: nil, audit_appcast: nil, audit_online: nil, audit_strict: nil, audit_token_conflicts: nil, audit_new_cask: nil, quarantine: nil, language: nil) ⇒ Auditor

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Auditor.


37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'Library/Homebrew/cask/auditor.rb', line 37

def initialize(
  cask,
  audit_download: nil,
  audit_appcast: nil,
  audit_online: nil,
  audit_strict: nil,
  audit_token_conflicts: nil,
  audit_new_cask: nil,
  quarantine: nil,
  language: nil
)
  @cask = cask
  @audit_download = audit_download
  @audit_appcast = audit_appcast
  @audit_online = audit_online
  @audit_new_cask = audit_new_cask
  @audit_strict = audit_strict
  @quarantine = quarantine
  @audit_token_conflicts = audit_token_conflicts
  @language = language
end

Instance Attribute Details

#caskObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


35
36
37
# File 'Library/Homebrew/cask/auditor.rb', line 35

def cask
  @cask
end

#languageObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


35
36
37
# File 'Library/Homebrew/cask/auditor.rb', line 35

def language
  @language
end

Class Method Details

.audit(cask, audit_download: nil, audit_appcast: nil, audit_online: nil, audit_new_cask: nil, audit_strict: nil, audit_token_conflicts: nil, quarantine: nil, language: nil) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'Library/Homebrew/cask/auditor.rb', line 11

def self.audit(
  cask,
  audit_download: nil,
  audit_appcast: nil,
  audit_online: nil,
  audit_new_cask: nil,
  audit_strict: nil,
  audit_token_conflicts: nil,
  quarantine: nil,
  language: nil
)
  new(
    cask,
    audit_download:        audit_download,
    audit_appcast:         audit_appcast,
    audit_online:          audit_online,
    audit_new_cask:        audit_new_cask,
    audit_strict:          audit_strict,
    audit_token_conflicts: audit_token_conflicts,
    quarantine:            quarantine,
    language:              language,
  ).audit
end

Instance Method Details

#auditObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'Library/Homebrew/cask/auditor.rb', line 59

def audit
  warnings = Set.new
  errors = Set.new

  if !language && language_blocks
    language_blocks.each_key do |l|
      audit = audit_languages(l)
      puts audit.summary
      warnings += audit.warnings
      errors += audit.errors
    end
  else
    audit = audit_cask_instance(cask)
    puts audit.summary
    warnings += audit.warnings
    errors += audit.errors
  end

  { warnings: warnings, errors: errors }
end