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



384
385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'lib/gitlab_exporter/cli.rb', line 384

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