Class: Discharger::SetupRunner::PreCommands::PreCommandRegistry

Inherits:
Object
  • Object
show all
Defined in:
lib/discharger/setup_runner/pre_commands/pre_command_registry.rb

Overview

Registry for pre-Rails commands. Maps command names (from setup.yml) to command classes.

Constant Summary collapse

BUILT_IN_COMMANDS =
{
  "homebrew" => HomebrewPreCommand,
  "postgresql_tools" => PostgresqlToolsPreCommand
}.freeze

Class Method Summary collapse

Class Method Details

.get(name) ⇒ Object



18
19
20
# File 'lib/discharger/setup_runner/pre_commands/pre_command_registry.rb', line 18

def get(name)
  custom_commands[name.to_s] || BUILT_IN_COMMANDS[name.to_s]
end

.namesObject



26
27
28
# File 'lib/discharger/setup_runner/pre_commands/pre_command_registry.rb', line 26

def names
  (BUILT_IN_COMMANDS.keys + custom_commands.keys).uniq
end

.register(name, command_class) ⇒ Object



22
23
24
# File 'lib/discharger/setup_runner/pre_commands/pre_command_registry.rb', line 22

def register(name, command_class)
  custom_commands[name.to_s] = command_class
end