Sha256: 9867f96c88fd84479ba8b101dfd299a722effdb166246aed75ac8050b40cab6a

Contents?: true

Size: 1.05 KB

Versions: 1

Compression:

Stored size: 1.05 KB

Contents

namespace :sunspot do
  namespace :solr do
    desc 'Start the Solr instance'
    task start: :environment do
      server.start
      puts 'Successfully started Solr ...'
    end

    desc 'Run the Solr instance in the foreground'
    task run: :environment do
      server.run
    end

    desc 'Stop the Solr instance'
    task stop: :environment do
      server.stop
      puts 'Successfully stopped Solr ...'
    end

    desc 'Restart the Solr instance'
    task restart: :environment do
      Rake::Task['sunspot:solr:stop'].invoke if File.exist?(server.pid_path)
      Rake::Task['sunspot:solr:start'].invoke
    end

    # for backwards compatibility
    task reindex: :"sunspot:reindex"

    def server
      case RUBY_PLATFORM
      when /w(in)?32$/, /java$/
        abort("This command is not supported on #{RUBY_PLATFORM}. " +
              "Use rake sunspot:solr:run to run Solr in the foreground.")
      end

      if defined?(Sunspot::Rails::Server)
        Sunspot::Rails::Server.new
      else
        Sunspot::Solr::Server.new
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sunspot_solr-2.1.1 lib/sunspot/solr/tasks.rb