Module: Homebrew::Bundle::GoInstaller Private

Defined in:
bundle/go_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!(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/go_installer.rb', line 26

def self.install!(name, preinstall: true, verbose: false, force: false, **_options)
  return true unless preinstall

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

  go = Bundle.which_go
  return false unless Bundle.system go.to_s, "install", "#{name}@latest", verbose: verbose

  installed_packages << name
  true
end

.installed_packagesObject

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/go_installer.rb', line 42

def self.installed_packages
  require "bundle/go_dumper"
  @installed_packages ||= Homebrew::Bundle::GoDumper.packages
end

.package_installed?(package) ⇒ 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/go_installer.rb', line 38

def self.package_installed?(package)
  installed_packages.include? package
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/go_installer.rb', line 11

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

  if package_installed?(name)
    puts "Skipping install of #{name} Go package. 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/go_installer.rb', line 7

def self.reset!
  @installed_packages = nil
end