Report abuse

require 'vendor/plugins/thinking-sphinx/recipes/thinking_sphinx'

# ...

namespace :deploy do

  task :rebuild_index, :roles => :app do
    thinking_sphinx.stop # turn off TS using the old production.sphinx.conf
    update
    thinking_sphinx.index
    thinking_sphinx.start
    restart
  end

end

task :symlink_sphinx_indexes, :roles => [:app] do
  run "ln -nfs #{shared_path}/db/sphinx #{current_path}/db/sphinx"
end

# this is where i load my production configuration files
task :update_config, :roles => [:app], :except => { :no_release => true } do
  # ...
  thinking_sphinx.configure
end  

before 'deploy:finalize_update', :symlink_sphinx_indexes
before 'deploy:finalize_update', :update_config