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.
16 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 |
# File 'bundle/installer.rb', line 16 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] = {} verb = "Installing" type = entry.type cls = case type when :brew = entry. verb = "Upgrading" if Homebrew::Bundle::BrewInstaller.formula_upgradable?(name) Homebrew::Bundle::BrewInstaller when :cask = entry. verb = "Upgrading" if Homebrew::Bundle::CaskInstaller.cask_upgradable?(name) Homebrew::Bundle::CaskInstaller when :mas args << entry.[:id] Homebrew::Bundle::MacAppStoreInstaller when :whalebrew Homebrew::Bundle::WhalebrewInstaller when :vscode Homebrew::Bundle::VscodeExtensionInstaller when :tap verb = "Tapping" = entry. Homebrew::Bundle::TapInstaller end next if cls.nil? next if Homebrew::Bundle::Skipper.skip? entry preinstall = if cls.preinstall(*args, **, no_upgrade:, verbose:) puts Formatter.success("#{verb} #{name}") true else puts "Using #{name}" unless quiet false end if cls.install(*args, **, 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 |