Class: ThinkingSphinx::Commander

Inherits:
Object
  • Object
show all
Defined in:
lib/thinking_sphinx/commander.rb

Class Method Summary collapse

Class Method Details

.call(command, configuration, options, stream = STDOUT) ⇒ Object



4
5
6
7
8
# File 'lib/thinking_sphinx/commander.rb', line 4

def self.call(command, configuration, options, stream = STDOUT)
  raise ThinkingSphinx::UnknownCommand unless registry.keys.include?(command)

  registry[command].call configuration, options, stream
end

.registryObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/thinking_sphinx/commander.rb', line 10

def self.registry
  @registry ||= {
    :clear_real_time  => ThinkingSphinx::Commands::ClearRealTime,
    :clear_sql        => ThinkingSphinx::Commands::ClearSQL,
    :configure        => ThinkingSphinx::Commands::Configure,
    :index_sql        => ThinkingSphinx::Commands::IndexSQL,
    :index_real_time  => ThinkingSphinx::Commands::IndexRealTime,
    :merge            => ThinkingSphinx::Commands::Merge,
    :merge_and_update => ThinkingSphinx::Commands::MergeAndUpdate,
    :prepare          => ThinkingSphinx::Commands::Prepare,
    :rotate           => ThinkingSphinx::Commands::Rotate,
    :running          => ThinkingSphinx::Commands::Running,
    :start_attached   => ThinkingSphinx::Commands::StartAttached,
    :start_detached   => ThinkingSphinx::Commands::StartDetached,
    :stop             => ThinkingSphinx::Commands::Stop
  }
end