Module: Homebrew::Bundle::Checker Private

Defined in:
bundle/checker.rb,
bundle/tap_checker.rb,
bundle/brew_checker.rb,
bundle/cask_checker.rb,
bundle/brew_service_checker.rb,
bundle/mac_app_store_checker.rb,
bundle/vscode_extension_checker.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.

Defined Under Namespace

Classes: Base, BrewChecker, BrewServiceChecker, CaskChecker, CheckResult, MacAppStoreChecker, TapChecker, VscodeExtensionChecker

Constant Summary collapse

CHECKS =

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.

{
  taps_to_tap:           "Taps",
  casks_to_install:      "Casks",
  extensions_to_install: "VSCode Extensions",
  apps_to_install:       "Apps",
  formulae_to_install:   "Formulae",
  formulae_to_start:     "Services",
}.freeze

Class Method Summary collapse

Class Method Details

.apps_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Object

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.



116
117
118
119
120
121
122
# File 'bundle/checker.rb', line 116

def self.apps_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false)
  require "bundle/mac_app_store_checker"
  Homebrew::Bundle::Checker::MacAppStoreChecker.new.find_actionable(
    @dsl.entries,
    exit_on_first_error:, no_upgrade:, verbose:,
  )
end

.casks_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Object

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.



92
93
94
95
96
97
98
# File 'bundle/checker.rb', line 92

def self.casks_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false)
  require "bundle/cask_checker"
  Homebrew::Bundle::Checker::CaskChecker.new.find_actionable(
    @dsl.entries,
    exit_on_first_error:, no_upgrade:, verbose:,
  )
end

.check(global: false, file: nil, exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Object

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.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'bundle/checker.rb', line 70

def self.check(global: false, file: nil, exit_on_first_error: false, no_upgrade: false, verbose: false)
  require "bundle/brewfile"
  @dsl ||= Brewfile.read(global:, file:)

  check_method_names = CHECKS.keys

  errors = []
  enumerator = exit_on_first_error ? :find : :map

  work_to_be_done = check_method_names.public_send(enumerator) do |check_method|
    check_errors =
      send(check_method, exit_on_first_error:, no_upgrade:, verbose:)
    any_errors = check_errors.any?
    errors.concat(check_errors) if any_errors
    any_errors
  end

  work_to_be_done = Array(work_to_be_done).flatten.any?

  CheckResult.new work_to_be_done, errors
end

.extensions_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Object

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.



124
125
126
127
128
129
130
# File 'bundle/checker.rb', line 124

def self.extensions_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false)
  require "bundle/vscode_extension_checker"
  Homebrew::Bundle::Checker::VscodeExtensionChecker.new.find_actionable(
    @dsl.entries,
    exit_on_first_error:, no_upgrade:, verbose:,
  )
end

.formulae_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Object

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.



100
101
102
103
104
105
106
# File 'bundle/checker.rb', line 100

def self.formulae_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false)
  require "bundle/brew_checker"
  Homebrew::Bundle::Checker::BrewChecker.new.find_actionable(
    @dsl.entries,
    exit_on_first_error:, no_upgrade:, verbose:,
  )
end

.formulae_to_start(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Object

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.



132
133
134
135
136
137
138
# File 'bundle/checker.rb', line 132

def self.formulae_to_start(exit_on_first_error: false, no_upgrade: false, verbose: false)
  require "bundle/brew_service_checker"
  Homebrew::Bundle::Checker::BrewServiceChecker.new.find_actionable(
    @dsl.entries,
    exit_on_first_error:, no_upgrade:, verbose:,
  )
end

.reset!Object

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.



140
141
142
143
144
145
146
147
148
149
150
151
152
153
# File 'bundle/checker.rb', line 140

def self.reset!
  require "bundle/cask_dumper"
  require "bundle/brew_dumper"
  require "bundle/mac_app_store_dumper"
  require "bundle/tap_dumper"
  require "bundle/brew_services"

  @dsl = nil
  Homebrew::Bundle::CaskDumper.reset!
  Homebrew::Bundle::BrewDumper.reset!
  Homebrew::Bundle::MacAppStoreDumper.reset!
  Homebrew::Bundle::TapDumper.reset!
  Homebrew::Bundle::BrewServices.reset!
end

.taps_to_tap(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Object

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.



108
109
110
111
112
113
114
# File 'bundle/checker.rb', line 108

def self.taps_to_tap(exit_on_first_error: false, no_upgrade: false, verbose: false)
  require "bundle/tap_checker"
  Homebrew::Bundle::Checker::TapChecker.new.find_actionable(
    @dsl.entries,
    exit_on_first_error:, no_upgrade:, verbose:,
  )
end