Class: Homebrew::DevCmd::DetermineTestRunners

Inherits:
AbstractCommand show all
Defined in:
dev-cmd/determine-test-runners.rb

Instance Attribute Summary

Attributes inherited from AbstractCommand

#args

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, command_name, #initialize, parser

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#runvoid

This method returns an undefined value.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'dev-cmd/determine-test-runners.rb', line 35

def run
  if args.no_named? && !args.all_supported?
    raise Homebrew::CLI::MinNamedArgumentsError, 1
  elsif args.all_supported? && !args.no_named?
    raise UsageError, "`--all-supported` is mutually exclusive to other arguments."
  end

  testing_formulae = args.named.first&.split(",").to_a
  testing_formulae.map! { |name| TestRunnerFormula.new(Formulary.factory(name), eval_all: args.eval_all?) }
                  .freeze
  deleted_formulae = args.named.second&.split(",").to_a.freeze
  runner_matrix = GitHubRunnerMatrix.new(testing_formulae, deleted_formulae,
                                         all_supported:    args.all_supported?,
                                         dependent_matrix: args.dependents?)
  runners = runner_matrix.active_runner_specs_hash

  ohai "Runners", JSON.pretty_generate(runners)

  github_output = ENV.fetch("GITHUB_OUTPUT")
  File.open(github_output, "a") do |f|
    f.puts("runners=#{runners.to_json}")
    f.puts("runners_present=#{runners.present?}")
  end
end