Module: Homebrew::Bundle Private
- Defined in:
- bundle.rb,
bundle/dsl.rb,
bundle/adder.rb,
bundle/dumper.rb,
bundle/lister.rb,
bundle/checker.rb,
bundle/remover.rb,
bundle/skipper.rb,
bundle/brewfile.rb,
bundle/installer.rb,
bundle/tap_dumper.rb,
bundle/brew_dumper.rb,
bundle/cask_dumper.rb,
bundle/tap_checker.rb,
bundle/brew_checker.rb,
bundle/cask_checker.rb,
bundle/commands/add.rb,
bundle/brew_services.rb,
bundle/commands/dump.rb,
bundle/commands/exec.rb,
bundle/commands/list.rb,
bundle/tap_installer.rb,
bundle/brew_installer.rb,
bundle/cask_installer.rb,
bundle/commands/check.rb,
bundle/commands/remove.rb,
bundle/commands/cleanup.rb,
bundle/commands/install.rb,
bundle/whalebrew_dumper.rb,
bundle/whalebrew_installer.rb,
bundle/brew_service_checker.rb,
bundle/mac_app_store_dumper.rb,
bundle/mac_app_store_checker.rb,
bundle/mac_app_store_installer.rb,
bundle/vscode_extension_dumper.rb,
bundle/vscode_extension_checker.rb,
bundle/vscode_extension_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.
Defined Under Namespace
Modules: Adder, BrewDumper, BrewServices, Brewfile, CaskDumper, CaskInstaller, Checker, Commands, Dumper, Installer, Lister, MacAppStoreDumper, MacAppStoreInstaller, Remover, Skipper, TapDumper, TapInstaller, VscodeExtensionDumper, VscodeExtensionInstaller, WhalebrewDumper, WhalebrewInstaller Classes: BrewInstaller, Dsl
Class Method Summary collapse
- .brew(*args, verbose: false) ⇒ Object private
- .cask_installed? ⇒ Boolean private
- .exchange_uid_if_needed!(&block) ⇒ Object private
- .formula_versions_from_env ⇒ Object private
- .mas_installed? ⇒ Boolean private
- .reset! ⇒ void private
- .system(cmd, *args, verbose: false) ⇒ Object private
- .vscode_installed? ⇒ Boolean private
- .whalebrew_installed? ⇒ Boolean private
- .which_formula(name) ⇒ Object private
- .which_vscode ⇒ Object private
Class Method Details
.brew(*args, 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.
26 27 28 |
# File 'bundle.rb', line 26 def brew(*args, verbose: false) system(HOMEBREW_BREW_FILE, *args, verbose:) end |
.cask_installed? ⇒ Boolean
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.
49 50 51 52 53 |
# File 'bundle.rb', line 49 def cask_installed? @cask_installed ||= File.directory?("#{HOMEBREW_PREFIX}/Caskroom") && (File.directory?("#{HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask") || !Homebrew::EnvConfig.no_install_from_api?) end |
.exchange_uid_if_needed!(&block) ⇒ 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.
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.rb', line 61 def exchange_uid_if_needed!(&block) euid = Process.euid uid = Process.uid return yield if euid == uid old_euid = euid process_reexchangeable = Process::UID.re_exchangeable? if process_reexchangeable Process::UID.re_exchange else Process::Sys.seteuid(uid) end home = T.must(Etc.getpwuid(Process.uid)).dir return_value = with_env("HOME" => home, &block) if process_reexchangeable Process::UID.re_exchange else Process::Sys.seteuid(old_euid) end return_value end |
.formula_versions_from_env ⇒ 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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'bundle.rb', line 86 def formula_versions_from_env @formula_versions_from_env ||= begin formula_versions = {} ENV.each do |key, value| match = key.match(/^HOMEBREW_BUNDLE_EXEC_FORMULA_VERSION_(.+)$/) next if match.blank? formula_name = match[1] next if formula_name.blank? ENV.delete(key) formula_versions[formula_name.downcase] = value end formula_versions end end |
.mas_installed? ⇒ Boolean
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.
30 31 32 |
# File 'bundle.rb', line 30 def mas_installed? @mas_installed ||= which_formula("mas") 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.
106 107 108 109 110 111 112 |
# File 'bundle.rb', line 106 def reset! @mas_installed = nil @vscode_installed = nil @whalebrew_installed = nil @cask_installed = nil @formula_versions_from_env = nil end |
.system(cmd, *args, 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.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'bundle.rb', line 9 def system(cmd, *args, verbose: false) return super cmd, *args if verbose logs = [] success = T.let(nil, T.nilable(T::Boolean)) IO.popen([cmd, *args], err: [:child, :out]) do |pipe| while (buf = pipe.gets) logs << buf end Process.wait(pipe.pid) success = $CHILD_STATUS.success? pipe.close end puts logs.join unless success success end |
.vscode_installed? ⇒ Boolean
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.
34 35 36 |
# File 'bundle.rb', line 34 def vscode_installed? @vscode_installed ||= which_vscode.present? end |
.whalebrew_installed? ⇒ Boolean
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.
45 46 47 |
# File 'bundle.rb', line 45 def whalebrew_installed? @whalebrew_installed ||= which_formula("whalebrew") end |
.which_formula(name) ⇒ 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.
55 56 57 58 59 |
# File 'bundle.rb', line 55 def which_formula(name) formula = Formulary.factory(name) ENV["PATH"] = "#{formula.opt_bin}:#{ENV.fetch("PATH", nil)}" if formula.any_version_installed? which(name).present? end |
.which_vscode ⇒ 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.
38 39 40 41 42 43 |
# File 'bundle.rb', line 38 def which_vscode @which_vscode ||= which("code", ORIGINAL_PATHS) @which_vscode ||= which("codium", ORIGINAL_PATHS) @which_vscode ||= which("cursor", ORIGINAL_PATHS) @which_vscode ||= which("code-insiders", ORIGINAL_PATHS) end |