Class: Homebrew::Bundle::PackageType Abstract Private

Inherits:
Object
  • Object
show all
Extended by:
T::Helpers
Defined in:
bundle/package_type.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

This class is abstract.

It cannot be directly instantiated. Subclasses must implement the abstract methods below.

Direct Known Subclasses

Brew, Cask, Extension, Tap

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.batch_installable?(_name, _options = {}) ⇒ 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.

Parameters:

Returns:

  • (Boolean)


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

def self.batch_installable?(_name, _options = {})
  false
end

.check(entries, exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<String>

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.

Parameters:

  • entries (Array<Dsl::Entry>)
  • exit_on_first_error (Boolean) (defaults to: false)
  • no_upgrade (Boolean) (defaults to: false)
  • verbose (Boolean) (defaults to: false)

Returns:



87
88
89
# File 'bundle/package_type.rb', line 87

def self.check(entries, exit_on_first_error: false, no_upgrade: false, verbose: false)
  new.find_actionable(entries, exit_on_first_error:, no_upgrade:, verbose:)
end

.check_labelString

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 is abstract.

Returns:



25
# File 'bundle/package_type.rb', line 25

def self.check_label; end

.dumpString

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 is abstract.

Returns:



92
# File 'bundle/package_type.rb', line 92

def self.dump; end

.dump_output(describe: false, no_restart: false) ⇒ String

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.

Parameters:

  • describe (Boolean) (defaults to: false)
  • no_restart (Boolean) (defaults to: false)

Returns:



95
96
97
98
99
100
# File 'bundle/package_type.rb', line 95

def self.dump_output(describe: false, no_restart: false)
  _ = describe
  _ = no_restart

  dump
end

.dump_supported?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)


28
29
30
# File 'bundle/package_type.rb', line 28

def self.dump_supported?
  true
end

.inherited(subclass) ⇒ 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.

Parameters:



14
15
16
17
18
19
# File 'bundle/package_type.rb', line 14

def self.inherited(subclass)
  super
  return if subclass.name == "Homebrew::Bundle::Extension"

  Homebrew::Bundle.register_package_type(subclass)
end

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

This method is abstract.

Parameters:

  • name (String)
  • preinstall (Boolean) (defaults to: true)
  • no_upgrade (Boolean) (defaults to: false)
  • verbose (Boolean) (defaults to: false)
  • force (Boolean) (defaults to: false)
  • options (Homebrew::Bundle::EntryOption)

Returns:

  • (Boolean)


77
# File 'bundle/package_type.rb', line 77

def self.install!(name, preinstall: true, no_upgrade: false, verbose: false, force: false, **options); end

.install_batch!(_entries, verbose: false) ⇒ 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.

Parameters:

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


48
49
50
51
52
# File 'bundle/package_type.rb', line 48

def self.install_batch!(_entries, verbose: false)
  _ = verbose

  raise NotImplementedError
end

.install_supported?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)


33
34
35
# File 'bundle/package_type.rb', line 33

def self.install_supported?
  true
end

.install_verb(_name = "", _options = {}) ⇒ String

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.

Parameters:

Returns:



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

def self.install_verb(_name = "", _options = {})
  "Installing"
end

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

This method is abstract.

Parameters:

Returns:

  • (Boolean)


65
# File 'bundle/package_type.rb', line 65

def self.preinstall!(name, no_upgrade: false, verbose: false, **options); 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 is abstract.

This method returns an undefined value.



55
# File 'bundle/package_type.rb', line 55

def self.reset!; end

.typeSymbol

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 is abstract.

Returns:



22
# File 'bundle/package_type.rb', line 22

def self.type; end

Instance Method Details

#checkable_entries(all_entries) ⇒ Array<Dsl::Entry>

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.

Parameters:

Returns:



129
130
131
132
133
134
135
136
137
# File 'bundle/package_type.rb', line 129

def checkable_entries(all_entries)
  require "bundle/skipper"
  all_entries.filter_map do |entry|
    next if entry.type != self.class.type
    next if Bundle::Skipper.skip?(entry)

    entry
  end
end

#exit_early_check(packages, no_upgrade:) ⇒ Array<String>

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.

Parameters:

Returns:



103
104
105
106
107
108
109
110
# File 'bundle/package_type.rb', line 103

def exit_early_check(packages, no_upgrade:)
  packages.each do |pkg|
    next if installed_and_up_to_date?(pkg, no_upgrade:)

    return [failure_reason(pkg, no_upgrade:)]
  end
  []
end

#failure_reason(name, no_upgrade:) ⇒ String

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.

Parameters:

  • name (Object)
  • no_upgrade (Boolean)

Returns:



113
114
115
116
117
118
119
120
# File 'bundle/package_type.rb', line 113

def failure_reason(name, no_upgrade:)
  reason = if no_upgrade && Bundle.upgrade_formulae.exclude?(name)
    "needs to be installed."
  else
    "needs to be installed or updated."
  end
  "#{self.class.check_label} #{name} #{reason}"
end

#find_actionable(entries, exit_on_first_error: false, no_upgrade: false, verbose: false) ⇒ Array<String>

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.

Parameters:

  • entries (Array<Dsl::Entry>)
  • exit_on_first_error (Boolean) (defaults to: false)
  • no_upgrade (Boolean) (defaults to: false)
  • verbose (Boolean) (defaults to: false)

Returns:



157
158
159
160
161
162
163
164
165
# File 'bundle/package_type.rb', line 157

def find_actionable(entries, exit_on_first_error: false, no_upgrade: false, verbose: false)
  requested = format_checkable(entries)

  if exit_on_first_error
    exit_early_check(requested, no_upgrade:)
  else
    full_check(requested, no_upgrade:)
  end
end

#format_checkable(entries) ⇒ Array<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.

Parameters:

Returns:



140
141
142
# File 'bundle/package_type.rb', line 140

def format_checkable(entries)
  checkable_entries(entries).map(&:name)
end

#full_check(packages, no_upgrade:) ⇒ Array<String>

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.

Parameters:

Returns:



123
124
125
126
# File 'bundle/package_type.rb', line 123

def full_check(packages, no_upgrade:)
  packages.reject { |pkg| installed_and_up_to_date?(pkg, no_upgrade:) }
          .map { |pkg| failure_reason(pkg, no_upgrade:) }
end

#installed_and_up_to_date?(_pkg, no_upgrade: false) ⇒ 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.

Parameters:

  • _pkg (Object)
  • no_upgrade (Boolean) (defaults to: false)

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


145
146
147
# File 'bundle/package_type.rb', line 145

def installed_and_up_to_date?(_pkg, no_upgrade: false)
  raise NotImplementedError
end