Class: Homebrew::DevCmd::DetermineTestRunners Private

Inherits:
AbstractCommand show all
Defined in:
dev-cmd/determine-test-runners.rb,
sorbet/rbi/dsl/homebrew/dev_cmd/determine_test_runners.rbi

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.

Defined Under Namespace

Classes: Args

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, command_name, dev_cmd?, #initialize, parser, ruby_cmd?

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#argsHomebrew::DevCmd::DetermineTestRunners::Args

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.



10
# File 'sorbet/rbi/dsl/homebrew/dev_cmd/determine_test_runners.rbi', line 10

def args; end

#runvoid

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.



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