Module: Homebrew::Bundle::Installer Private

Defined in:
bundle/installer.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.

Class Method Summary collapse

Class Method Details

.install!(entries, global: false, file: nil, no_lock: false, no_upgrade: false, verbose: false, force: false, quiet: 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.

 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
# File 'bundle/installer.rb', line 17 def self.install!(entries, global: false, file: nil, no_lock: false, no_upgrade: false, verbose: false, force: false, quiet: false) success = 0 failure = 0 entries.each do |entry| name = entry.name args = [name] options = {} verb = "Installing" type = entry.type cls = case type when :brew options = entry.options verb = "Upgrading" if Homebrew::Bundle::FormulaInstaller.formula_upgradable?(name) Homebrew::Bundle::FormulaInstaller when :cask options = entry.options verb = "Upgrading" if Homebrew::Bundle::CaskInstaller.cask_upgradable?(name) Homebrew::Bundle::CaskInstaller when :mas args << entry.options[:id] Homebrew::Bundle::MacAppStoreInstaller when :whalebrew Homebrew::Bundle::WhalebrewInstaller when :vscode Homebrew::Bundle::VscodeExtensionInstaller when :go Homebrew::Bundle::GoInstaller when :tap verb = "Tapping" options = entry.options Homebrew::Bundle::TapInstaller end next if cls.nil? next if Homebrew::Bundle::Skipper.skip? entry preinstall = if cls.preinstall!(*args, **options, no_upgrade:, verbose:) puts Formatter.success("#{verb} #{name}") true else puts "Using #{name}" unless quiet false end if cls.install!(*args, **options, preinstall:, no_upgrade:, verbose:, force:) success += 1 else $stderr.puts Formatter.error("#{verb} #{name} has failed!") failure += 1 end end unless failure.zero? dependency = Homebrew::Bundle::Dsl.pluralize_dependency(failure) $stderr.puts Formatter.error "`brew bundle` failed! #{failure} Brewfile #{dependency} failed to install" return false end unless quiet dependency = Homebrew::Bundle::Dsl.pluralize_dependency(success) puts Formatter.success "`brew bundle` complete! #{success} Brewfile #{dependency} now installed." end true end