Module: Homebrew::Bundle::VscodeExtensionInstaller Private

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

Class Method Summary collapse

Class Method Details

.extension_installed?(name) ⇒ 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)
[View source]

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

def self.extension_installed?(name)
  installed_extensions.include? name.downcase
end

.install(name, preinstall: true, no_upgrade: false, verbose: false, force: 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.

[View source]

27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'bundle/vscode_extension_installer.rb', line 27

def self.install(name, preinstall: true, no_upgrade: false, verbose: false, force: false)
  return true unless preinstall
  return true if extension_installed?(name)

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

  return false unless Bundle.exchange_uid_if_needed! do
    Bundle.system(Bundle.which_vscode, "--install-extension", name, verbose:)
  end

  installed_extensions << name

  true
end

.installed_extensionsObject

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.

[View source]

46
47
48
49
# File 'bundle/vscode_extension_installer.rb', line 46

def self.installed_extensions
  require "bundle/vscode_extension_dumper"
  @installed_extensions ||= Homebrew::Bundle::VscodeExtensionDumper.extensions
end

.preinstall(name, no_upgrade: false, 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.

[View source]

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

def self.preinstall(name, no_upgrade: false, verbose: false)
  if !Bundle.vscode_installed? && Bundle.cask_installed?
    puts "Installing visual-studio-code. It is not currently installed." if verbose
    Bundle.brew("install", "--cask", "visual-studio-code", verbose:)
  end

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

  raise "Unable to install #{name} VSCode extension. VSCode is not installed." unless Bundle.vscode_installed?

  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.

[View source]

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

def self.reset!
  @installed_extensions = nil
end