diff --git a/Library/Homebrew/extend/on_system.rb b/Library/Homebrew/extend/on_system.rb index d151e26ddd..a7f7b3744f 100644 --- a/Library/Homebrew/extend/on_system.rb +++ b/Library/Homebrew/extend/on_system.rb @@ -25,7 +25,7 @@ module OnSystem return true if [:macos, *MacOSVersions::SYMBOLS.keys].include?(os_name) end - return Homebrew::SimulateSystem.send("treat_as_#{os_name}?") if BASE_OS_OPTIONS.include?(os_name) + return Homebrew::SimulateSystem.send("simulating_or_running_on_#{os_name}?") if BASE_OS_OPTIONS.include?(os_name) raise ArgumentError, "Invalid OS condition: #{os_name.inspect}" unless MacOSVersions::SYMBOLS.key?(os_name) @@ -33,7 +33,7 @@ module OnSystem raise ArgumentError, "Invalid OS `or_*` condition: #{or_condition.inspect}" end - return false if Homebrew::SimulateSystem.treat_as_linux? + return false if Homebrew::SimulateSystem.simulating_or_running_on_linux? base_os = MacOS::Version.from_symbol(os_name) current_os = MacOS::Version.from_symbol(Homebrew::SimulateSystem.current_os) diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index 1f842d6aaa..d2f9ea56f2 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -3215,7 +3215,7 @@ class Formula # Permit links to certain libraries that don't exist. Available on Linux only. def ignore_missing_libraries(*libs) - unless Homebrew::SimulateSystem.treat_as_linux? + unless Homebrew::SimulateSystem.simulating_or_running_on_linux? raise FormulaSpecificationError, "#{__method__} is available on Linux only" end diff --git a/Library/Homebrew/simulate_system.rb b/Library/Homebrew/simulate_system.rb index c93791afb9..de61eabef7 100644 --- a/Library/Homebrew/simulate_system.rb +++ b/Library/Homebrew/simulate_system.rb @@ -32,14 +32,14 @@ module Homebrew end sig { returns(T::Boolean) } - def treat_as_macos? + def simulating_or_running_on_macos? return OS.mac? if @os.blank? [:macos, *MacOSVersions::SYMBOLS.keys].include?(@os) end sig { returns(T::Boolean) } - def treat_as_linux? + def simulating_or_running_on_linux? return OS.linux? if @os.blank? @os == :linux diff --git a/Library/Homebrew/software_spec.rb b/Library/Homebrew/software_spec.rb index 14825ce168..30e9856d83 100644 --- a/Library/Homebrew/software_spec.rb +++ b/Library/Homebrew/software_spec.rb @@ -174,7 +174,7 @@ class SoftwareSpec return if Homebrew::EnvConfig.simulate_macos_on_linux? && !bounds.key?(:since) # macOS new enough for dependency to not be required. - if Homebrew::SimulateSystem.treat_as_macos? + if Homebrew::SimulateSystem.simulating_or_running_on_macos? current_os = MacOS::Version.from_symbol(Homebrew::SimulateSystem.current_os) since_os = MacOS::Version.from_symbol(bounds[:since]) if bounds.key?(:since) return if current_os >= since_os diff --git a/Library/Homebrew/test/simulate_system_spec.rb b/Library/Homebrew/test/simulate_system_spec.rb index 9994b71fea..0b72700d9f 100644 --- a/Library/Homebrew/test/simulate_system_spec.rb +++ b/Library/Homebrew/test/simulate_system_spec.rb @@ -8,63 +8,63 @@ describe Homebrew::SimulateSystem do described_class.clear end - describe "::treat_as_macos?" do + describe "::simulating_or_running_on_macos?" do it "returns true on macOS", :needs_macos do described_class.clear - expect(described_class.treat_as_macos?).to be true + expect(described_class.simulating_or_running_on_macos?).to be true end it "returns false on Linux", :needs_linux do described_class.clear - expect(described_class.treat_as_macos?).to be false + expect(described_class.simulating_or_running_on_macos?).to be false end it "returns false on macOS when simulating Linux", :needs_macos do described_class.clear described_class.os = :linux - expect(described_class.treat_as_macos?).to be false + expect(described_class.simulating_or_running_on_macos?).to be false end it "returns true on Linux when simulating a generic macOS version", :needs_linux do described_class.clear described_class.os = :macos - expect(described_class.treat_as_macos?).to be true + expect(described_class.simulating_or_running_on_macos?).to be true end it "returns true on Linux when simulating a specific macOS version", :needs_linux do described_class.clear described_class.os = :monterey - expect(described_class.treat_as_macos?).to be true + expect(described_class.simulating_or_running_on_macos?).to be true end end - describe "::treat_as_linux?" do + describe "::simulating_or_running_on_linux?" do it "returns true on Linux", :needs_linux do described_class.clear - expect(described_class.treat_as_linux?).to be true + expect(described_class.simulating_or_running_on_linux?).to be true end it "returns false on macOS", :needs_macos do described_class.clear - expect(described_class.treat_as_linux?).to be false + expect(described_class.simulating_or_running_on_linux?).to be false end it "returns true on macOS when simulating Linux", :needs_macos do described_class.clear described_class.os = :linux - expect(described_class.treat_as_linux?).to be true + expect(described_class.simulating_or_running_on_linux?).to be true end it "returns false on Linux when simulating a generic macOS version", :needs_linux do described_class.clear described_class.os = :macos - expect(described_class.treat_as_linux?).to be false + expect(described_class.simulating_or_running_on_linux?).to be false end it "returns false on Linux when simulating a specific macOS version", :needs_linux do described_class.clear described_class.os = :monterey - expect(described_class.treat_as_linux?).to be false + expect(described_class.simulating_or_running_on_linux?).to be false end end