Sha256: 823f3e94decc3d9da20057c78ceb55c5d2ef046840eeafd888ecb36823815cae
Contents?: true
Size: 1.62 KB
Versions: 1
Compression:
Stored size: 1.62 KB
Contents
class ThinkingSphinx::RakeInterface def configure puts "Generating configuration to #{configuration.configuration_file}" configuration.render_to_file end def generate configuration.preload_indices configuration.render FileUtils.mkdir_p configuration.indices_location configuration.indices.each do |index| next unless index.is_a?(ThinkingSphinx::RealTime::Index) puts "Generating index files for #{index.name}" transcriber = ThinkingSphinx::RealTime::Transcriber.new index Dir["#{index.path}*"].each { |file| FileUtils.rm file } index.model.find_each do |instance| transcriber.copy instance print "." end print "\n" controller.rotate end end def index(reconfigure = true) configure if reconfigure FileUtils.mkdir_p configuration.indices_location ThinkingSphinx.before_index_hooks.each { |hook| hook.call } 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 configuration ThinkingSphinx::Configuration.instance end def controller configuration.controller end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
thinking-sphinx-3.0.3 | lib/thinking_sphinx/rake_interface.rb |