Class: TestRunnerFormula
Constant Summary collapse
Instance Attribute Summary collapse
- #eval_all ⇒ Boolean readonly private
- #formula ⇒ Formula readonly private
- #name ⇒ String readonly private
Instance Method Summary collapse
- #arm64_compatible? ⇒ Boolean private
- #arm64_only? ⇒ Boolean private
- #compatible_with?(macos_version) ⇒ Boolean private
- #dependents(platform:, arch:, macos_version:) ⇒ Array<TestRunnerFormula> private
- #initialize(formula, eval_all: Homebrew::EnvConfig.eval_all?) ⇒ void constructor private
- #linux_compatible? ⇒ Boolean private
- #linux_only? ⇒ Boolean private
- #macos_compatible? ⇒ Boolean private
- #macos_only? ⇒ Boolean private
- #versioned_macos_requirement ⇒ MacOSRequirement? private
- #x86_64_compatible? ⇒ Boolean private
- #x86_64_only? ⇒ Boolean private
Constructor Details
#initialize(formula, eval_all: Homebrew::EnvConfig.eval_all?) ⇒ 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.
17 18 19 20 21 22 23 24 |
# File 'test_runner_formula.rb', line 17 def initialize(formula, eval_all: Homebrew::EnvConfig.eval_all?) Formulary.enable_factory_cache! @formula = T.let(formula, Formula) @name = T.let(formula.name, String) @dependent_hash = T.let({}, T::Hash[Symbol, T::Array[TestRunnerFormula]]) @eval_all = T.let(eval_all, T::Boolean) freeze end |
Instance Attribute Details
#eval_all ⇒ Boolean (readonly)
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.
14 15 16 |
# File 'test_runner_formula.rb', line 14 def eval_all @eval_all end |
#formula ⇒ Formula (readonly)
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.
11 12 13 |
# File 'test_runner_formula.rb', line 11 def formula @formula end |
#name ⇒ String (readonly)
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.
8 9 10 |
# File 'test_runner_formula.rb', line 8 def name @name end |
Instance Method Details
#arm64_compatible? ⇒ 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.
62 63 64 |
# File 'test_runner_formula.rb', line 62 def arm64_compatible? !x86_64_only? end |
#arm64_only? ⇒ 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.
57 58 59 |
# File 'test_runner_formula.rb', line 57 def arm64_only? formula.requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :arm64) } end |
#compatible_with?(macos_version) ⇒ 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.
72 73 74 75 76 77 78 |
# File 'test_runner_formula.rb', line 72 def compatible_with?(macos_version) # Assign to a variable to assist type-checking. requirement = versioned_macos_requirement return true if requirement.blank? macos_version.public_send(requirement.comparator, requirement.version) end |
#dependents(platform:, arch:, macos_version:) ⇒ Array<TestRunnerFormula>
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.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'test_runner_formula.rb', line 89 def dependents(platform:, arch:, macos_version:) cache_key = :"#{platform}_#{arch}_#{macos_version}" @dependent_hash[cache_key] ||= begin formula_selector, eval_all_env = if eval_all [:all, "1"] else [:installed, nil] end with_env(HOMEBREW_EVAL_ALL: eval_all_env) do os = macos_version || platform arch = SIMULATE_SYSTEM_SYMBOLS.fetch(arch) Homebrew::SimulateSystem.with(os:, arch:) do Formula.public_send(formula_selector) .select { |candidate_f| candidate_f.deps.map(&:name).include?(name) } .map { |f| TestRunnerFormula.new(f, eval_all:) } .freeze end end end @dependent_hash.fetch(cache_key) end |
#linux_compatible? ⇒ 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.
42 43 44 |
# File 'test_runner_formula.rb', line 42 def linux_compatible? !macos_only? end |
#linux_only? ⇒ 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.
37 38 39 |
# File 'test_runner_formula.rb', line 37 def linux_only? formula.requirements.any?(LinuxRequirement) end |
#macos_compatible? ⇒ 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.
32 33 34 |
# File 'test_runner_formula.rb', line 32 def macos_compatible? !linux_only? end |
#macos_only? ⇒ 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.
27 28 29 |
# File 'test_runner_formula.rb', line 27 def macos_only? formula.requirements.any? { |r| r.is_a?(MacOSRequirement) && !r.version_specified? } end |
#versioned_macos_requirement ⇒ MacOSRequirement?
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.
67 68 69 |
# File 'test_runner_formula.rb', line 67 def versioned_macos_requirement formula.requirements.find { |r| r.is_a?(MacOSRequirement) && r.version_specified? } end |
#x86_64_compatible? ⇒ 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.
52 53 54 |
# File 'test_runner_formula.rb', line 52 def x86_64_compatible? !arm64_only? end |
#x86_64_only? ⇒ 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.
47 48 49 |
# File 'test_runner_formula.rb', line 47 def x86_64_only? formula.requirements.any? { |r| r.is_a?(ArchRequirement) && (r.arch == :x86_64) } end |