Module: Homebrew::Bundle::Checker Private
- Defined in:
- bundle/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: CheckResult
Constant Summary collapse
- CheckStep =
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.
T.type_alias { Symbol }
- CORE_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.
T.let([ :taps_to_tap, :casks_to_install, :registered_extensions_to_install, :apps_to_install, :formulae_to_install, :formulae_to_start, ].freeze, T::Array[CheckStep])
Class Method Summary collapse
- .apps_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<String> private
- .casks_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<String> private
- .check(global: false, file: nil, exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ CheckResult private
- .extension_errors(step, exit_on_first_error:, no_upgrade:, verbose:) ⇒ Array<String> private
- .formulae_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<String> private
- .formulae_to_start(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<String> private
- .package_type_errors(type, exit_on_first_error:, no_upgrade:, verbose:) ⇒ Array<String> private
- .registered_extensions_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<String> private
- .reset! ⇒ void private
- .taps_to_tap(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<String> private
Class Method Details
.apps_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ 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.
64 65 66 |
# File 'bundle/checker.rb', line 64 def self.apps_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) extension_errors(:apps_to_install, exit_on_first_error:, no_upgrade:, verbose:) end |
.casks_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ 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.
102 103 104 |
# File 'bundle/checker.rb', line 102 def self.casks_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) package_type_errors(:cask, exit_on_first_error:, no_upgrade:, verbose:) end |
.check(global: false, file: nil, exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ CheckResult
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.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'bundle/checker.rb', line 37 def self.check(global: false, file: nil, exit_on_first_error: false, no_upgrade: false, verbose: false) require "bundle/brewfile" @dsl = T.let(@dsl, T.nilable(Homebrew::Bundle::Dsl)) @dsl ||= Brewfile.read(global:, file:) errors = T.let([], T::Array[String]) enumerator = exit_on_first_error ? :find : :map work_to_be_done = CORE_CHECKS.public_send(enumerator) do |check_step| check_errors = public_send(check_step, 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 |
.extension_errors(step, exit_on_first_error:, no_upgrade:, verbose:) ⇒ 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.
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'bundle/checker.rb', line 136 def self.extension_errors(step, exit_on_first_error:, no_upgrade:, verbose:) raise ArgumentError, "dsl is unset!" unless @dsl matching_extensions = Homebrew::Bundle.extensions.select { |extension| extension.legacy_check_step == step } errors = T.let([], T::Array[String]) matching_extensions.each do |extension| check_errors = extension.check( @dsl.entries, exit_on_first_error:, no_upgrade:, verbose:, ) next if check_errors.empty? return check_errors if exit_on_first_error errors.concat(check_errors) end errors end |
.formulae_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ 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.
113 114 115 |
# File 'bundle/checker.rb', line 113 def self.formulae_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) package_type_errors(:brew, exit_on_first_error:, no_upgrade:, verbose:) end |
.formulae_to_start(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ 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.
75 76 77 78 79 80 81 82 |
# File 'bundle/checker.rb', line 75 def self.formulae_to_start(exit_on_first_error: false, no_upgrade: false, verbose: false) raise ArgumentError, "dsl is unset!" unless @dsl Homebrew::Bundle::Brew::Services.new.find_actionable( @dsl.entries, exit_on_first_error:, no_upgrade:, verbose:, ) end |
.package_type_errors(type, exit_on_first_error:, no_upgrade:, verbose:) ⇒ 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.
172 173 174 175 176 177 178 179 |
# File 'bundle/checker.rb', line 172 def self.package_type_errors(type, exit_on_first_error:, no_upgrade:, verbose:) raise ArgumentError, "dsl is unset!" unless @dsl package_type = Homebrew::Bundle.package_type(type) return [] if package_type.nil? package_type.check(@dsl.entries, exit_on_first_error:, no_upgrade:, verbose:) end |
.registered_extensions_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ 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.
124 125 126 |
# File 'bundle/checker.rb', line 124 def self.registered_extensions_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) extension_errors(:registered_extensions_to_install, exit_on_first_error:, no_upgrade:, verbose:) end |
.reset! ⇒ void
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.
158 159 160 161 162 |
# File 'bundle/checker.rb', line 158 def self.reset! @dsl = T.let(nil, T.nilable(Homebrew::Bundle::Dsl)) Homebrew::Bundle.package_types.each(&:reset!) Homebrew::Bundle.extensions.each(&:reset!) end |
.taps_to_tap(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ 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.
91 92 93 |
# File 'bundle/checker.rb', line 91 def self.taps_to_tap(exit_on_first_error: false, no_upgrade: false, verbose: false) package_type_errors(:tap, exit_on_first_error:, no_upgrade:, verbose:) end |