Sha256: e79c683118260fe4233bd12da211f3bf7871f40c2fece62e52ebc1d03f5105ef

Contents?: true

Size: 983 Bytes

Versions: 2

Compression:

Stored size: 983 Bytes

Contents

class ThinkingSphinx::RakeInterface
  def configure
    puts "Generating configuration to #{config.configuration_file}"
    config.render_to_file
  end

  def index(reconfigure = true)
    configure if reconfigure
    FileUtils.mkdir_p config.indices_location
    controller.index :verbose => true
  end

  def start
    raise RuntimeError, 'searchd is already running' if controller.running?

    controller.start

    if controller.running?
      puts "Started searchd successfully (pid: #{controller.pid})."
    else
      puts "Failed to start searchd. Check the log files for more information."
    end
  end

  def stop
    unless controller.running?
      puts 'searchd is not currently running.' and return
    end

    pid = controller.pid
    until controller.stop do
      sleep(0.5)
    end

    puts "Stopped searchd daemon (pid: #{pid})."
  end

  private

  def config
    ThinkingSphinx::Configuration.instance
  end

  def controller
    config.controller
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thinking-sphinx-3.0.0.rc lib/thinking_sphinx/rake_interface.rb
thinking-sphinx-3.0.0.pre lib/thinking_sphinx/rake_interface.rb