Module: Utils::Output Private

Extended by:
Cacheable, T::Generic, Mixin
Defined in:
utils/output.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.

Helper methods for outputting messages in Homebrew's formats.

Defined Under Namespace

Modules: Mixin

Constant Summary collapse

Cache =

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.

type_template { { fixed: T::Hash[String, T::Boolean] } }

Class Method Summary collapse

Methods included from Cacheable

cache, clear_cache

Methods included from Mixin

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

Class Method Details

.claim_warning(message) ⇒ Boolean

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.

Reserve a warning for one caller in this process, including across threads.

Parameters:

Returns:

  • (Boolean)


18
19
20
21
22
23
24
# File 'utils/output.rb', line 18

def self.claim_warning(message)
  @warnings_mutex.synchronize do
    return false if cache[message]

    cache[message] = true
  end
end

.clear_cache ⇒ 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.



27
28
29
# File 'utils/output.rb', line 27

def self.clear_cache
  @warnings_mutex.synchronize { super }
end

.redirect_stdout(file, &_block) ⇒ T.type_parameter(:U)

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:

Returns:

  • (T.type_parameter(:U))


36
37
38
39
40
41
42
43
# File 'utils/output.rb', line 36

def self.redirect_stdout(file, &_block)
  out = $stdout.dup
  $stdout.reopen(file)
  yield
ensure
  $stdout.reopen(out)
  out.close
end