Spec-Zone.ru › Homebrew

Class: Cask::Auditor Private

Inherits:
Object
  • Object
  • Cask::Auditor
show all
Includes:
Utils::Output::Mixin
Defined in:
cask/auditor.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Helper class for auditing all available languages of a cask.

Constant Summary collapse

LANGUAGE_BLOCK_LIMIT =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

10

Instance Attribute Summary collapse

  • #cask ⇒ ::Cask::Cask readonly private
  • #language ⇒ String? readonly private

Class Method Summary collapse

  • .audit(cask, audit_download: false, audit_online: nil, audit_strict: nil, audit_signing: nil, audit_new_cask: nil, quarantine: false, any_named_args: false, language: nil, only: [], except: []) ⇒ Set<Audit::Error> private

Instance Method Summary collapse

  • #audit ⇒ Set<Audit::Error> private
  • #initialize(cask, audit_download: false, audit_online: nil, audit_strict: nil, audit_signing: nil, audit_new_cask: nil, quarantine: false, any_named_args: false, language: nil, only: [], except: []) ⇒ void constructor private

Methods included from Utils::Output::Mixin

#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_upgradable, #pretty_warning

Constructor Details

#initialize(cask, audit_download: false, audit_online: nil, audit_strict: nil, audit_signing: nil, audit_new_cask: nil, quarantine: false, any_named_args: false, language: nil, only: [], except: []) ⇒ void

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Parameters:

  • cask (::Cask::Cask)
  • audit_download (Boolean) (defaults to: false)
  • audit_online (Boolean, nil) (defaults to: nil)
  • audit_strict (Boolean, nil) (defaults to: nil)
  • audit_signing (Boolean, nil) (defaults to: nil)
  • audit_new_cask (Boolean, nil) (defaults to: nil)
  • quarantine (Boolean) (defaults to: false)
  • any_named_args (Boolean) (defaults to: false)
  • language (String, nil) (defaults to: nil)
  • only (Array<String>) (defaults to: [])
  • except (Array<String>) (defaults to: [])


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'cask/auditor.rb', line 46

def initialize(
  cask,
  audit_download: false,
  audit_online: nil,
  audit_strict: nil,
  audit_signing: nil,
  audit_new_cask: nil,
  quarantine: false,
  any_named_args: false,
  language: nil,
  only: [],
  except: []
)
  @cask = cask
  @audit_download = audit_download
  @audit_online = audit_online
  @audit_new_cask = audit_new_cask
  @audit_strict = audit_strict
  @audit_signing = audit_signing
  @quarantine = quarantine
  @any_named_args = any_named_args
  @language = language
  @only = only
  @except = except
end

Instance Attribute Details

#cask ⇒ ::Cask::Cask (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (::Cask::Cask)


33
34
35
# File 'cask/auditor.rb', line 33

def cask
  @cask
end

#language ⇒ String? (readonly)

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (String, nil)


36
37
38
# File 'cask/auditor.rb', line 36

def language
  @language
end

Class Method Details

.audit(cask, audit_download: false, audit_online: nil, audit_strict: nil, audit_signing: nil, audit_new_cask: nil, quarantine: false, any_named_args: false, language: nil, only: [], except: []) ⇒ Set<Audit::Error>

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

TODO:

use argument forwarding (...) when Sorbet supports it in strict mode

Parameters:

  • cask (::Cask::Cask)
  • audit_download (Boolean) (defaults to: false)
  • audit_online (Boolean, nil) (defaults to: nil)
  • audit_strict (Boolean, nil) (defaults to: nil)
  • audit_signing (Boolean, nil) (defaults to: nil)
  • audit_new_cask (Boolean, nil) (defaults to: nil)
  • quarantine (Boolean) (defaults to: false)
  • any_named_args (Boolean) (defaults to: false)
  • language (String, nil) (defaults to: nil)
  • only (Array<String>) (defaults to: [])
  • except (Array<String>) (defaults to: [])

Returns:

  • (Set<Audit::Error>)


21
22
23
24
25
26
27
28
29
30
# File 'cask/auditor.rb', line 21

def self.audit(
  cask, audit_download: false, audit_online: nil, audit_strict: nil, audit_signing: nil,
  audit_new_cask: nil, quarantine: false, any_named_args: false, language: nil,
  only: [], except: []
)
  new(
    cask, audit_download:, audit_online:, audit_strict:, audit_signing:,
    audit_new_cask:, quarantine:, any_named_args:, language:, only:, except:
  ).audit
end

Instance Method Details

#audit ⇒ Set<Audit::Error>

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Set<Audit::Error>)


75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'cask/auditor.rb', line 75

def audit
  errors = Set.new

  if !language && !(blocks = language_blocks).empty?
    sample_languages = if blocks.length > LANGUAGE_BLOCK_LIMIT && !@audit_new_cask
      sample_keys = T.must(blocks.keys.sample(LANGUAGE_BLOCK_LIMIT))
      ohai "Auditing a sample of available languages for #{cask}: " \
           "#{sample_keys.map { |lang| lang[0].to_s }.to_sentence}"
      blocks.select { |k| sample_keys.include?(k) }
    else
      blocks
    end

    sample_languages.each_key do |l|
      audit = audit_languages(l)
      if audit.summary.present? && output_summary?(audit)
        ohai "Auditing language: #{l.map { |lang| "'#{lang}'" }.to_sentence}" if output_summary?
        puts audit.summary
      end
      errors += audit.errors
    end
  else
    audit = audit_cask_instance(cask)
    puts audit.summary if audit.summary.present? && output_summary?(audit)
    errors += audit.errors
  end

  errors
end

© 2009–present Homebrew contributors
Licensed under the BSD 2-Clause License.
https://docs.brew.sh/rubydoc/Cask/Auditor.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API