Define MacOS::Version::SYMBOLS on macOS and linux

This commit is contained in:
Rylan Polster 2022-06-23 17:49:08 -04:00
parent 6ebd5174d6
commit f38db6e100
No known key found for this signature in database
GPG Key ID: 46A744940CFF4D64
4 changed files with 24 additions and 27 deletions

View File

@ -1,6 +1,8 @@
# typed: true
# frozen_string_literal: true
require "version"
# Helper functions for querying operating system information.
#
# @api private
@ -48,6 +50,25 @@ module OS
CI_GLIBC_VERSION = "2.23"
CI_OS_VERSION = "Ubuntu 16.04"
module Mac
::MacOS = OS::Mac
class Version < ::Version
# TODO: when removing symbols here, ensure that they are added to
# DEPRECATED_MACOS_VERSIONS in MacOSRequirement.
SYMBOLS = {
ventura: "13",
monterey: "12",
big_sur: "11",
catalina: "10.15",
mojave: "10.14",
high_sierra: "10.13",
sierra: "10.12",
el_capitan: "10.11",
}.freeze
end
end
if OS.mac?
require "os/mac"
# Don't tell people to report issues on unsupported configurations.

View File

@ -31,12 +31,6 @@ module OS
module Mac
module_function
# rubocop:disable Naming/ConstantName
# rubocop:disable Style/MutableConstant
::MacOS = OS::Mac
# rubocop:enable Naming/ConstantName
# rubocop:enable Style/MutableConstant
raise "Loaded OS::Linux on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
def version

View File

@ -13,12 +13,6 @@ module OS
module_function
# rubocop:disable Naming/ConstantName
# rubocop:disable Style/MutableConstant
::MacOS = OS::Mac
# rubocop:enable Naming/ConstantName
# rubocop:enable Style/MutableConstant
raise "Loaded OS::Mac on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"]
VERSION = ENV.fetch("HOMEBREW_MACOS_VERSION").chomp.freeze

View File

@ -13,22 +13,10 @@ module OS
class Version < ::Version
extend T::Sig
# TODO: when removing symbols here, ensure that they are added to
# DEPRECATED_MACOS_VERSIONS in MacOSRequirement.
SYMBOLS = {
ventura: "13",
monterey: "12",
big_sur: "11",
catalina: "10.15",
mojave: "10.14",
high_sierra: "10.13",
sierra: "10.12",
el_capitan: "10.11",
}.freeze
# TODO: bump version when new macOS is released or announced
# and also update references in docs/Installation.md and
# https://github.com/Homebrew/install/blob/HEAD/install.sh
# and also update references in docs/Installation.md,
# https://github.com/Homebrew/install/blob/HEAD/install.sh and
# OS::Mac::Version (in HOMEBREW_LIBRARY/os.rb)
NEWEST_UNSUPPORTED = "13"
private_constant :NEWEST_UNSUPPORTED