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<Object> private
- .casks_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<Object> 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<Object> private
- .formulae_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<Object> private
- .formulae_to_start(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<Object> private
- .package_type_errors(type, exit_on_first_error:, no_upgrade:, verbose:) ⇒ Array<Object> private
- .registered_extensions_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<Object> private
- .reset! ⇒ void private
- .taps_to_tap(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<Object> private
Class Method Details
.apps_to_install(exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<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.
59 60 61 |
# File 'bundle/checker.rb', line 59 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<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.
97 98 99 |
# File 'bundle/checker.rb', line 97 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.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'bundle/checker.rb', line 32 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[Object]) 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<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.
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'bundle/checker.rb', line 131 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[Object]) 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<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 |
# File 'bundle/checker.rb', line 108 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<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 |
# File 'bundle/checker.rb', line 70 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<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 |
# File 'bundle/checker.rb', line 167 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<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 |
# File 'bundle/checker.rb', line 119 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.
153 154 155 156 157 |
# File 'bundle/checker.rb', line 153 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<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.
86 87 88 |
# File 'bundle/checker.rb', line 86 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 |