Module: GitLab::Monitor::CLI

Defined in:
lib/gitlab_monitor/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-mon".freeze

Class Method Summary collapse

Class Method Details

.commandsObject



326
327
328
329
330
331
332
333
334
335
336
337
338
339
# File 'lib/gitlab_monitor/cli.rb', line 326

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



13
14
15
# File 'lib/gitlab_monitor/cli.rb', line 13

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