Module: Homebrew::Bundle::Checker Private

Defined in:
bundle/checker.rb,
bundle/go_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, GoChecker, 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",
  go_packages_to_install: "Go Packages",
}.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.



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

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.



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

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.



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

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.



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

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.



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

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.



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

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

.go_packages_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.



141
142
143
144
145
146
147
# File 'bundle/checker.rb', line 141

def self.go_packages_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false)
  require "bundle/go_checker"
  Homebrew::Bundle::Checker::GoChecker.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.



149
150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'bundle/checker.rb', line 149

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

  @dsl = nil
  Homebrew::Bundle::CaskDumper.reset!
  Homebrew::Bundle::FormulaDumper.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.



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

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