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

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



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

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:



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

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:



98
99
100
101
102
103
# File 'bundle/package_type.rb', line 98

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

.fetchable_name(name, options = {}, no_upgrade: 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:

Returns:



49
50
51
52
53
54
55
# File 'bundle/package_type.rb', line 49

def self.fetchable_name(name, options = {}, no_upgrade: false)
  _ = name
  _ = options
  _ = no_upgrade

  nil
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)


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

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


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

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.



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

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:



132
133
134
135
136
137
138
139
140
# File 'bundle/package_type.rb', line 132

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:



106
107
108
109
110
111
112
113
# File 'bundle/package_type.rb', line 106

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:



116
117
118
119
120
121
122
123
# File 'bundle/package_type.rb', line 116

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:



160
161
162
163
164
165
166
167
168
# File 'bundle/package_type.rb', line 160

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:



143
144
145
# File 'bundle/package_type.rb', line 143

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:



126
127
128
129
# File 'bundle/package_type.rb', line 126

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)


148
149
150
# File 'bundle/package_type.rb', line 148

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