From 158a2025ee5f18160ce7638f8639910153926206 Mon Sep 17 00:00:00 2001 From: Pat Allan Date: Sat, 23 May 2009 15:35:50 -0700 Subject: [PATCH] Adding rebuild rake task, from a patch provided by Anderson Dias. --- README.textile | 1 + lib/thinking_sphinx/tasks.rb | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/README.textile b/README.textile index fef699d2a..4e27e8a61 100644 --- a/README.textile +++ b/README.textile @@ -127,3 +127,4 @@ Since I first released this library, there's been quite a few people who have su * Mike Bailey * Bill Leeper * Michael Reinsch +* Anderson Dias diff --git a/lib/thinking_sphinx/tasks.rb b/lib/thinking_sphinx/tasks.rb index 3eb816ff9..d73cd566a 100644 --- a/lib/thinking_sphinx/tasks.rb +++ b/lib/thinking_sphinx/tasks.rb @@ -75,6 +75,13 @@ system cmd end + desc "Stop Sphinx (if it's running), rebuild the indexes, and start Sphinx" + task :rebuild => :app_env do + Rake::Task["thinking_sphinx:stop"].invoke if sphinx_running? + Rake::Task["thinking_sphinx:index"].invoke + Rake::Task["thinking_sphinx:start"].invoke + end + namespace :index do task :delta => :app_env do ThinkingSphinx.indexed_models.select { |model| @@ -122,6 +129,8 @@ task :conf => "thinking_sphinx:configure" desc "Generate the Sphinx configuration file using Thinking Sphinx's settings" task :config => "thinking_sphinx:configure" + desc "Stop Sphinx (if it's running), rebuild the indexes, and start Sphinx" + task :rebuild => "thinking_sphinx:rebuild" desc "Process stored delta index requests" task :dd => "thinking_sphinx:delayed_delta" end