Class: FlyingSphinx::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/flying_sphinx/cli.rb

Constant Summary collapse

COMMANDS =
{
  'configure'  => "ts:configure",
  'index'      => "ts:index",
  'setup'      => "ts:index",
  'start'      => "ts:start",
  'stop'       => "ts:stop",
  'restart'    => "ts:restart",
  'rebuild'    => "ts:rebuild",
  'regenerate' => "ts:rebuild"
}

Instance Method Summary collapse

Constructor Details

#initialize(command, arguments = []) ⇒ CLI

Returns a new instance of CLI.



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

def initialize(command, arguments = [])
  @command, @arguments = command, arguments
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/flying_sphinx/cli.rb', line 17

def run
  task = COMMANDS[@command]
  raise "Unknown command #{@command}" if task.nil?

  puts <<-MESSAGE
The flying_sphinx CLI tool is now deprecated. Please use the standard Thinking
Sphinx tasks instead. (Thinking Sphinx tasks will now invoke the appropriate
behaviour for both local and Flying Sphinx environments). In this case:

  heroku run rake #{task}
  MESSAGE

  `bundle exec rake #{task}`
end