Skip to content

Instantly share code, notes, and snippets.

@UserAd
Created November 18, 2009 14:04
Show Gist options
  • Save UserAd/237870 to your computer and use it in GitHub Desktop.
Save UserAd/237870 to your computer and use it in GitHub Desktop.
namespace :sphinx do
desc 'make symlinks'
task :symlink do
run <<-CMD
if [ ! -d #{shared_path}/sphinx ]; then mkdir -p #{shared_path}/sphinx; fi;
rm -fr #{release_path}/db/sphinx &&
ln -nfs #{shared_path}/sphinx #{release_path}/db/sphinx
CMD
end
desc 'update config file'
task :conf, :roles => :app do
run "cd #{current_path} && rake ts:conf RAILS_ENV=production"
end
desc 'Stop the sphinx server'
task :stop , :roles => :app do
conf
run "cd #{current_path} && rake thinking_sphinx:stop RAILS_ENV=production"
end
desc 'Start the sphinx server'
task :start, :roles => :app do
run "cd #{current_path} && rake thinking_sphinx:configure RAILS_ENV=production && rake thinking_sphinx:start RAILS_ENV=production"
end
desc 'Restart the sphinx server'
task :restart, :roles => :app do
stop
start
end
desc 'Rebuild search index'
task :rebuild do
run "cd #{current_path} && rake thinking_sphinx:rebuild RAILS_ENV=production"
end
end
after 'deploy:symlink', 'sphinx:symlink'
after 'deploy:restart', 'sphinx:restart'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment