Module: Homebrew::Bundle::WhalebrewInstaller Private

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

.image_installed?(image) ⇒ 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.

Returns:

  • (Boolean)


38
39
40
# File 'bundle/whalebrew_installer.rb', line 38

def self.image_installed?(image)
  installed_images.include? image
end

.install(name, preinstall: true, verbose: false, force: false, **_options) ⇒ 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
29
30
31
32
33
34
35
36
# File 'bundle/whalebrew_installer.rb', line 26

def self.install(name, preinstall: true, verbose: false, force: false, **_options)
  # odeprecated "`brew bundle` `whalebrew` support", "using `whalebrew` directly"
  return true unless preinstall

  puts "Installing #{name} image. It is not currently installed." if verbose

  return false unless Bundle.system "whalebrew", "install", name, verbose: verbose

  installed_images << name
  true
end

.installed_imagesObject

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.



42
43
44
45
# File 'bundle/whalebrew_installer.rb', line 42

def self.installed_images
  require "bundle/whalebrew_dumper"
  @installed_images ||= Homebrew::Bundle::WhalebrewDumper.images
end

.preinstall(name, verbose: false, **_options) ⇒ 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.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'bundle/whalebrew_installer.rb', line 11

def self.preinstall(name, verbose: false, **_options)
  unless Bundle.whalebrew_installed?
    puts "Installing whalebrew. It is not currently installed." if verbose
    Bundle.brew("install", "--formula", "whalebrew", verbose:)
    raise "Unable to install #{name} app. Whalebrew installation failed." unless Bundle.whalebrew_installed?
  end

  if image_installed?(name)
    puts "Skipping install of #{name} app. It is already installed." if verbose
    return false
  end

  true
end

.reset!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.



7
8
9
# File 'bundle/whalebrew_installer.rb', line 7

def self.reset!
  @installed_images = nil
end