Sha256: e93d11e06f494b8ae6e69c90665c2f46eec70bf77effadd833a437e19f8e4018

Contents?: true

Size: 905 Bytes

Versions: 9

Compression:

Stored size: 905 Bytes

Contents

namespace :sphinx do
  desc "Run indexer"
  task :index do
    cd 'config' do
      system 'indexer --all'
    end
  end

  desc "Rotate idendexes and restart searchd server"
  task :rotate do
    cd 'config' do
      system 'indexer --rotate --all'
    end
  end
  
  desc "Start searchd server"
  task :start do
    if File.exists?('/var/run/searchd.pid')
      puts 'Sphinx searchd server is already started.'
    else
      cd 'config' do
        system 'searchd'
        puts 'Sphinx searchd server started.'
      end
    end
  end
  
  desc "Stop searchd server"
  task :stop do
    unless File.exists?('/var/run/searchd.pid')
      puts 'Sphinx searchd server is not running.'
    else
      pid = File.read('/var/run/searchd.pid').chomp
      system "kill #{pid}"
      puts 'Sphinx searchd server stopped.'
    end
  end
  
  desc "Restart searchd server"
  task :restart => [:stop, :start]
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
datamapper-0.2.0 plugins/can_has_sphinx/tasks/acts_as_sphinx_tasks.rake
datamapper-0.2.1 plugins/can_has_sphinx/tasks/acts_as_sphinx_tasks.rake
datamapper-0.2.2 plugins/can_has_sphinx/tasks/acts_as_sphinx_tasks.rake
datamapper-0.2.3 plugins/can_has_sphinx/tasks/acts_as_sphinx_tasks.rake
datamapper-0.2.4 plugins/can_has_sphinx/tasks/acts_as_sphinx_tasks.rake
datamapper-0.2.5 plugins/can_has_sphinx/tasks/acts_as_sphinx_tasks.rake
datamapper-0.3.2 plugins/can_has_sphinx/tasks/acts_as_sphinx_tasks.rake
datamapper-0.3.0 plugins/can_has_sphinx/tasks/acts_as_sphinx_tasks.rake
datamapper-0.3.1 plugins/can_has_sphinx/tasks/acts_as_sphinx_tasks.rake