Sha256: fc7213c31b7ffa3ad2d68799271bf3aaaa12e8c1708ebf54b80475452c4cfc53

Contents?: true

Size: 788 Bytes

Versions: 4

Compression:

Stored size: 788 Bytes

Contents

require 'escape'

namespace :sunspot do
  namespace :solr do
    desc 'Start the Solr instance'
    task :start => :environment do
      data_path = File.join(::Rails.root, 'solr', 'data', ::Rails.env)
      pid_path = File.join(::Rails.root, 'solr', 'pids', ::Rails.env)
      [data_path, pid_path].each { |path| FileUtils.mkdir_p(path) }
      port = Sunspot::Rails.configuration.port
      FileUtils.cd(File.join(pid_path)) do
        system(Escape.shell_command(['sunspot-solr', 'start', '--', '-p', port.to_s, '-d', data_path]))
      end
    end

    desc 'Stop the Solr instance'
    task :stop => :environment do
      FileUtils.cd(File.join(::Rails.root, 'solr', 'pids', ::Rails.env)) do
        system(Escape.shell_command(['sunspot-solr', 'stop']))
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
outoftime-sunspot_rails-0.9.4 tasks/sunspot.rake
outoftime-sunspot_rails-0.9.6 tasks/sunspot.rake
outoftime-sunspot_rails-0.9.7 tasks/sunspot.rake
outoftime-sunspot_rails-0.9.8 lib/sunspot/rails/tasks.rb