Module: GitLab::Exporter::CLI

Defined in:
lib/gitlab_exporter/cli.rb

Overview

Stores runner classes in a single place

The entry point is the module method “for” which takes the name of a runner. In case the runner is invalid it will return a NullRunner which fails with an InvalidCLICommand error, which contains the general application usage instructions.

Defined Under Namespace

Classes: DatabaseRowCounts, DatabaseTupleStats, GIT, GitProcess, InvalidCLICommand, NullRunner, Process, Server, SidekiqRunner

Constant Summary collapse

EXECUTABLE_NAME =
"gitlab-exporter".freeze

Class Method Summary collapse

Class Method Details

.commandsObject



366
367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/gitlab_exporter/cli.rb', line 366

def self.commands
  [
    GIT,
    DatabaseTupleStats,
    DatabaseRowCounts,
    Process,
    GitProcess,
    SidekiqRunner,
    Server
  ].each_with_object({}) do |command_class, commands|
    commands[command_class::COMMAND_NAME] = command_class
    commands
  end
end

.for(name) ⇒ Object



29
30
31
# File 'lib/gitlab_exporter/cli.rb', line 29

def self.for(name)
  commands.fetch(name, NullRunner)
end