Class: Homebrew::SimulateSystem Private

Inherits:
Object
  • Object
show all
Defined in:
simulate_system.rb

Overview

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Helper module for simulating different system condfigurations.

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.archObject

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.



12
13
14
# File 'simulate_system.rb', line 12

def arch
  @arch
end

Class Method Details

.clearvoid

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.

This method returns an undefined value.



37
38
39
# File 'simulate_system.rb', line 37

def clear
  @os = @arch = nil
end

.current_archSymbol

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:



56
57
58
# File 'simulate_system.rb', line 56

def current_arch
  @arch || Hardware::CPU.type
end

.current_osSymbol

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:



61
62
63
64
65
66
# File 'simulate_system.rb', line 61

def current_os
  return T.must(os) if os.present?
  return :linux if OS.linux?

  MacOS.version.to_sym
end

.osSymbol?

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:



15
16
17
18
19
# File 'simulate_system.rb', line 15

def os
  return :macos if @os.blank? && !OS.mac? && Homebrew::EnvConfig.simulate_macos_on_linux?

  @os
end

.os=(new_os) ⇒ void

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.

This method returns an undefined value.

Parameters:



22
23
24
25
26
27
# File 'simulate_system.rb', line 22

def os=(new_os)
  os_options = [:macos, :linux, *MacOSVersions::SYMBOLS.keys]
  raise "Unknown OS: #{new_os}" unless os_options.include?(new_os)

  @os = new_os
end

.simulating_or_running_on_linux?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)


49
50
51
52
53
# File 'simulate_system.rb', line 49

def simulating_or_running_on_linux?
  return OS.linux? if os.blank?

  os == :linux
end

.simulating_or_running_on_macos?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)


42
43
44
45
46
# File 'simulate_system.rb', line 42

def simulating_or_running_on_macos?
  return OS.mac? if os.blank?

  [:macos, *MacOSVersions::SYMBOLS.keys].include?(os)
end