Class: Homebrew::Bundle::Checker::Base Private

Inherits:
Object
  • Object
show all
Defined in:
bundle/checker.rb

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.

Instance Method Summary collapse

Instance Method Details

#checkable_entries(all_entries) ⇒ 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.



34
35
36
37
38
# File 'bundle/checker.rb', line 34

def checkable_entries(all_entries)
  require "bundle/skipper"
  all_entries.select { |e| e.type == self.class::PACKAGE_TYPE }
             .reject(&Bundle::Skipper.method(:skip?))
end

#exit_early_check(packages, no_upgrade:) ⇒ 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.

Implement these in any subclass PACKAGE_TYPE = :pkg PACKAGE_TYPE_NAME = "Package"



12
13
14
15
16
17
18
# File 'bundle/checker.rb', line 12

def exit_early_check(packages, no_upgrade:)
  work_to_be_done = packages.find do |pkg|
    !installed_and_up_to_date?(pkg, no_upgrade:)
  end

  Array(work_to_be_done)
end

#failure_reason(name, no_upgrade:) ⇒ 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.



20
21
22
23
24
25
26
27
# File 'bundle/checker.rb', line 20

def failure_reason(name, no_upgrade:)
  reason = if no_upgrade
    "needs to be installed."
  else
    "needs to be installed or updated."
  end
  "#{self.class::PACKAGE_TYPE_NAME} #{name} #{reason}"
end

#find_actionable(entries, exit_on_first_error: false, 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.



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

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) ⇒ 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.



40
41
42
# File 'bundle/checker.rb', line 40

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

#full_check(packages, no_upgrade:) ⇒ 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.



29
30
31
32
# File 'bundle/checker.rb', line 29

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.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


44
45
46
# File 'bundle/checker.rb', line 44

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