Class: Polyrun::CLI

Inherits:
Object
  • Object
show all
Includes:
CiShardRunCommand, CiShardRunParse, ConfigCommand, CoverageCommands, DatabaseCommands, DefaultRun, EnvCommands, Help, Helpers, InitCommand, PlanCommand, PrepareCommand, QueueCommand, QuickCommand, ReportCommands, RunShardsCommand, TimingCommand
Defined in:
lib/polyrun/cli.rb,
lib/polyrun/cli/help.rb,
lib/polyrun/cli/helpers.rb,
lib/polyrun/cli/default_run.rb,
lib/polyrun/cli/env_commands.rb,
lib/polyrun/cli/init_command.rb,
lib/polyrun/cli/plan_command.rb,
lib/polyrun/cli/queue_command.rb,
lib/polyrun/cli/quick_command.rb,
lib/polyrun/cli/config_command.rb,
lib/polyrun/cli/prepare_recipe.rb,
lib/polyrun/cli/run_shards_run.rb,
lib/polyrun/cli/timing_command.rb,
lib/polyrun/cli/prepare_command.rb,
lib/polyrun/cli/report_commands.rb,
lib/polyrun/cli/start_bootstrap.rb,
lib/polyrun/cli/coverage_commands.rb,
lib/polyrun/cli/coverage_merge_io.rb,
lib/polyrun/cli/database_commands.rb,
lib/polyrun/cli/ci_shard_run_parse.rb,
lib/polyrun/cli/run_shards_command.rb,
lib/polyrun/cli/run_shards_planning.rb,
lib/polyrun/cli/ci_shard_run_command.rb,
lib/polyrun/cli/run_shards_plan_options.rb,
lib/polyrun/cli/run_shards_plan_boot_phases.rb

Defined Under Namespace

Modules: CiShardRunCommand, CiShardRunParse, ConfigCommand, CoverageCommands, CoverageMergeIo, DatabaseCommands, DefaultRun, EnvCommands, Help, Helpers, InitCommand, PlanCommand, PrepareCommand, PrepareRecipe, QueueCommand, QuickCommand, ReportCommands, RunShardsCommand, RunShardsPlanBootPhases, RunShardsPlanOptions, RunShardsPlanning, RunShardsRun, StartBootstrap, TimingCommand

Constant Summary collapse

CI_SHARD_COMMANDS =
{
  "ci-shard-run" => :cmd_ci_shard_run,
  "ci-shard-rspec" => :cmd_ci_shard_rspec
}.freeze
DISPATCH_SUBCOMMAND_NAMES =

Keep in sync with dispatch_cli_command_subcommands (when branches). Used for implicit path routing.

%w[
  plan prepare merge-coverage report-coverage report-junit report-timing
  env config merge-timing db:setup-template db:setup-shard db:clone-shards
  run-shards parallel-rspec start build-paths init queue quick
].freeze
IMPLICIT_PATH_EXCLUSION_TOKENS =

First argv token that is a normal subcommand (not a path); if argv is not here but looks like paths, run implicit parallel.

(
  DISPATCH_SUBCOMMAND_NAMES + CI_SHARD_COMMANDS.keys + %w[help version]
).freeze

Constants included from InitCommand

InitCommand::INIT_PROFILES

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Help

#print_help

Class Method Details

.run(argv = ARGV) ⇒ Object



58
59
60
# File 'lib/polyrun/cli.rb', line 58

def self.run(argv = ARGV)
  new.run(argv)
end

Instance Method Details

#run(argv) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/polyrun/cli.rb', line 62

def run(argv)
  argv = argv.dup
  config_path = parse_global_cli!(argv)
  return config_path if config_path.is_a?(Integer)

  if argv.empty?
    Polyrun::Debug.log_kv(
      command: "(default)",
      cwd: Dir.pwd,
      polyrun_config: config_path,
      argv_rest: [],
      verbose: @verbose
    )
    return dispatch_default_parallel!(config_path)
  end

  if implicit_parallel_run?(argv)
    Polyrun::Debug.log_kv(
      command: "(paths)",
      cwd: Dir.pwd,
      polyrun_config: config_path,
      argv_rest: argv.dup,
      verbose: @verbose
    )
    return dispatch_implicit_parallel_targets!(argv, config_path)
  end

  command = argv.shift

  Polyrun::Debug.log_kv(
    command: command,
    cwd: Dir.pwd,
    polyrun_config: config_path,
    argv_rest: argv.dup,
    verbose: @verbose
  )

  dispatch_cli_command(command, argv, config_path)
end