diff --git a/Library/Homebrew/os.rb b/Library/Homebrew/os.rb index 52945a402a..b2d6c64cad 100644 --- a/Library/Homebrew/os.rb +++ b/Library/Homebrew/os.rb @@ -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. diff --git a/Library/Homebrew/os/linux.rb b/Library/Homebrew/os/linux.rb index 6c029ef8be..57598261ef 100644 --- a/Library/Homebrew/os/linux.rb +++ b/Library/Homebrew/os/linux.rb @@ -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 diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index bb75f0de9c..b23e62dd8b 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -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 diff --git a/Library/Homebrew/os/mac/version.rb b/Library/Homebrew/os/mac/version.rb index 130d1c4f63..a7d183eaef 100644 --- a/Library/Homebrew/os/mac/version.rb +++ b/Library/Homebrew/os/mac/version.rb @@ -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