Module: Homebrew::Missing Private

Defined in:
missing.rb

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.

Class Method Summary collapse

Class Method Details

.deps(formulae, casks = [], hide = [], &_block) ⇒ Hash{String => Array<String>}

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:



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'missing.rb', line 30

def self.deps(formulae, casks = [], hide = [], &_block)
  missing = {}
  formulae.each do |formula|
    missing_dependencies = formula.missing_dependencies(hide: hide).map(&:to_s)
    next if missing_dependencies.empty?

    yield formula.full_name, missing_dependencies if block_given?
    missing[formula.full_name] = missing_dependencies
  end

  casks.each do |cask|
    missing_dependencies = cask_deps(cask, hide)
    next if missing_dependencies.empty?

    yield cask.full_name, missing_dependencies if block_given?
    missing[cask.full_name] = missing_dependencies
  end
  missing
end

.format_deps(package_name, missing_dependencies, show_name: true) ⇒ String

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.

Formats missing dependencies, optionally prefixed with the package name.

Parameters:

  • package_name (String)
  • missing_dependencies (Array<String>)
  • show_name (Boolean) (defaults to: true)

Returns:



13
14
15
16
# File 'missing.rb', line 13

def self.format_deps(package_name, missing_dependencies, show_name: true)
  name_prefix = show_name ? "#{package_name}: " : ""
  "#{name_prefix}#{missing_dependencies.join(" ")}"
end

.install_commands(missing) ⇒ Array<String>

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.

Commands to install missing dependencies without marking them as requested.

Parameters:

Returns:



20
21
22
23
# File 'missing.rb', line 20

def self.install_commands(missing)
  packages = missing.values.flatten.uniq.sort.join(" ")
  ["brew install --as-dependency #{packages}"]
end