Module: Homebrew::MinimumVersion Private

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

.cask_installed_below?(cask, minimum_version) ⇒ 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:



25
26
27
28
29
30
31
32
33
34
35
36
# File 'minimum_version.rb', line 25

def self.cask_installed_below?(cask, minimum_version)
  minimum_cask_version = comparable_cask_version(minimum_version)
  raise UsageError, "invalid `--minimum-version`: #{minimum_version}" if minimum_cask_version.nil?

  installed_version = cask.installed_version
  return false if installed_version.blank?

  installed_cask_version = comparable_cask_version(installed_version)
  return false if installed_cask_version.nil?

  installed_cask_version < minimum_cask_version
end

.formula_outdated_kegs(formula, minimum_version, fetch_head:) ⇒ Array<Keg>

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:

  • formula (Formula)
  • minimum_version (String, nil)
  • fetch_head (Boolean)

Returns:



14
15
16
17
18
19
20
21
22
# File 'minimum_version.rb', line 14

def self.formula_outdated_kegs(formula, minimum_version, fetch_head:)
  return formula.outdated_kegs(fetch_head:) if minimum_version.blank?

  minimum_pkg_version = PkgVersion.parse(minimum_version)
  formula.installed_kegs.select do |keg|
    keg.version_scheme < formula.version_scheme ||
      (keg.version_scheme == formula.version_scheme && keg.version < minimum_pkg_version)
  end
end