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/cargo_checker.rb,
bundle/flatpak_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, CargoChecker, CaskChecker, CheckResult, FlatpakChecker, 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",
  cargo_packages_to_install: "Cargo Packages",
  flatpaks_to_install:       "Flatpaks",
}.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.



119
120
121
122
123
124
125
# File 'bundle/checker.rb', line 119

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

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



151
152
153
154
155
156
157
# File 'bundle/checker.rb', line 151

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



95
96
97
98
99
100
101
# File 'bundle/checker.rb', line 95

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.



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

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.



127
128
129
130
131
132
133
# File 'bundle/checker.rb', line 127

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

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



159
160
161
162
163
164
165
# File 'bundle/checker.rb', line 159

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



103
104
105
106
107
108
109
# File 'bundle/checker.rb', line 103

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.



135
136
137
138
139
140
141
# File 'bundle/checker.rb', line 135

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.



143
144
145
146
147
148
149
# File 'bundle/checker.rb', line 143

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.



167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'bundle/checker.rb', line 167

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.



111
112
113
114
115
116
117
# File 'bundle/checker.rb', line 111

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