Module: OS::Mac::MacOSRequirement Private

Extended by:
T::Helpers
Included in:
MacOSRequirement
Defined in:
extend/os/mac/requirements/macos_requirement.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.

Instance Method Summary collapse

Instance Method Details

#macos_version_satisfied?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)


12
13
14
# File 'extend/os/mac/requirements/macos_requirement.rb', line 12

def macos_version_satisfied?
  !version_specified? || Array(version).any? { |v| OS::Mac.version.compare(comparator, v) }
end

#message(type: :formula) ⇒ 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:

  • type (Symbol) (defaults to: :formula)

Returns:



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'extend/os/mac/requirements/macos_requirement.rb', line 17

def message(type: :formula)
  subject = (type == :cask) ? "This cask" : "This formula"

  return "#{subject} requires macOS." unless version_specified?

  case comparator
  when ">="
    "#{subject} does not run on macOS versions older than #{T.cast(version, MacOSVersion).pretty_name}."
  when "<="
    case type
    when :formula
      <<~EOS
        #{subject} either does not compile or function as expected on macOS
        versions newer than #{T.cast(version, MacOSVersion).pretty_name} due to an upstream incompatibility.
      EOS
    when :cask
      "#{subject} does not run on macOS versions newer than #{T.cast(version, MacOSVersion).pretty_name}."
    else
      ""
    end
  else
    if version.respond_to?(:to_ary) || version.is_a?(Array)
      *versions, last = T.unsafe(version).map(&:pretty_name)
      return "#{subject} does not run on macOS versions other than #{versions.join(", ")} and #{last}."
    end

    "#{subject} does not run on macOS versions other than #{T.cast(version, MacOSVersion).pretty_name}."
  end
end