Module: Homebrew::Diagnostic Private

Extended by:
Utils::Output::Mixin
Defined in:
diagnostic.rb

Overview

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

Module containing diagnostic checks.

Defined Under Namespace

Classes: Checks

Class Method Summary collapse

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_outdated, pretty_uninstalled, pretty_upgradable

Class Method Details

.checks(type, fatal: true) ⇒ 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.

This method returns an undefined value.

Parameters:

  • type (Symbol)
  • fatal (Boolean) (defaults to: true)


25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'diagnostic.rb', line 25

def self.checks(type, fatal: true)
  @checks ||= T.let(Checks.new, T.nilable(Checks))
  failed = T.let(false, T::Boolean)
  @checks.public_send(type).each do |check|
    out = @checks.public_send(check)
    next if out.nil?

    if fatal
      failed ||= true
      ofail out
    else
      opoo out
    end
  end
  exit 1 if failed && fatal
end