Class: Homebrew::Cmd::Uses Private

Inherits:
AbstractCommand show all
Includes:
DependenciesHelpers
Defined in:
cmd/uses.rb,
sorbet/rbi/dsl/homebrew/cmd/uses.rbi

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.

DO NOT EDIT MANUALLY This is an autogenerated file for dynamic methods in Homebrew::Cmd::Uses. Please instead update this file by running bin/tapioca dsl Homebrew::Cmd::Uses.

Defined Under Namespace

Classes: Args

Instance Method Summary collapse

Methods included from DependenciesHelpers

#args_includes_ignores, dependents, #recursive_includes, #select_includes

Methods included from Kernel

#disk_usage_readable, #ensure_executable!, #ensure_formula_installed!, #exec_browser, #exec_editor, #ignore_interrupts, #interactive_shell, #number_readable, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #paths, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled, #quiet_system, #redact_secrets, #redirect_stdout, #require?, #safe_system, #tap_and_name_comparison, #truncate_text_to_approximate_size, #which, #which_all, #which_editor, #with_custom_locale, #with_env, #with_homebrew_path

Methods inherited from AbstractCommand

command, command_name, dev_cmd?, #initialize, parser

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#argsHomebrew::Cmd::Uses::Args

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.



9
# File 'sorbet/rbi/dsl/homebrew/cmd/uses.rbi', line 9

def args; end

#runvoid

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.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'cmd/uses.rb', line 57

def run
  Formulary.enable_factory_cache!

  used_formulae_missing = false
  used_formulae = begin
    args.named.to_formulae
  rescue FormulaUnavailableError => e
    opoo e
    used_formulae_missing = true
    # If the formula doesn't exist: fake the needed formula object name.
    # This is a legacy use of OpenStruct that should be refactored.
    # rubocop:disable Style/OpenStructUse
    args.named.map { |name| OpenStruct.new name:, full_name: name }
    # rubocop:enable Style/OpenStructUse
  end

  use_runtime_dependents = args.installed? &&
                           !used_formulae_missing &&
                           !args.include_build? &&
                           !args.include_test? &&
                           !args.include_optional? &&
                           !args.skip_recommended?

  uses = intersection_of_dependents(use_runtime_dependents, used_formulae)

  return if uses.empty?

  puts Formatter.columns(uses.map(&:full_name).sort)
  odie "Missing formulae should not have dependents!" if used_formulae_missing
end