Class: FlyingSphinx::CLI
- Inherits:
-
Object
- Object
- FlyingSphinx::CLI
- Defined in:
- lib/flying_sphinx/cli.rb
Constant Summary collapse
- COMMANDS =
{ 'configure' => [:configure], 'index' => [:index], 'setup' => [:configure, :index], 'start' => [:start], 'stop' => [:stop], 'restart' => [:stop, :start], 'rebuild' => [:stop, :configure, :index, :start] }
Instance Method Summary collapse
-
#initialize(command, arguments = []) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(command, arguments = []) ⇒ CLI
Returns a new instance of CLI.
12 13 14 |
# File 'lib/flying_sphinx/cli.rb', line 12 def initialize(command, arguments = []) @command, @arguments = command, arguments end |
Instance Method Details
#run ⇒ Object
16 17 18 19 20 21 |
# File 'lib/flying_sphinx/cli.rb', line 16 def run methods = COMMANDS[@command] raise "Unknown command #{@command}" if methods.nil? methods.all? { |method| send method } end |