Sha256: a0f84eb27140259b22c35862e870b99ef683a00899c58303184032519966b44c

Contents?: true

Size: 1.63 KB

Versions: 6

Compression:

Stored size: 1.63 KB

Contents

#!/usr/bin/env ruby
begin
  require 'fileutils'
  require 'tempfile'
  require 'tmpdir'
  require 'optparse'
  require File.join(File.dirname(__FILE__), '..', 'lib', 'sunspot', 'server')
rescue LoadError => e
  if require 'rubygems'
    retry
  else
    raise(e)
  end
end

server = Sunspot::Server.new

OptionParser.new do |opts|
  opts.banner = "Usage: sunspot-solr start [options]"

  opts.on '-p', '--port=PORT', 'Port on which to run Solr (default 8983)' do |p|
    server.port = p
  end

  opts.on '-d', '--data-directory=DIRECTORY', 'Solr data directory' do |d|
    server.solr_data_dir = File.expand_path(d)
  end

  opts.on '-s', '--solr-home=HOME', 'Solr home directory (should contain conf/ directory)' do |s|
    server.solr_home = File.expand_path(s)
  end

  opts.on '--pid-dir=PID_DIR', 'Directory for pid files' do |pd|
    server.pid_dir = File.expand_path(pd)
  end

  opts.on '-l', '--log-level=LOG_LEVEL', 'Solr logging level' do |l|
    server.log_level = l
  end

  opts.on '--log-file=LOG_FILE', 'Path to Solr log file' do |lf|
    server.log_file = File.expand_path(lf)
  end
  
  opts.on '--max-memory=MEMORY', 'Specify the maximum size of the memory allocation pool' do |mm|
    server.max_memory = mm
  end
  
  opts.on '--min-memory=MEMORY', 'Specify the initial size of the memory allocation pool' do |mm|
    server.min_memory = mm
  end
end.parse!

begin
  case ARGV[0]
  when 'start'
    server.start
  when 'run'
    server.run
  when 'stop'
    server.stop
  when 'restart'
    server.stop
    server.start
  else
    abort("Usage: sunspot-solr (start|stop|run)")
  end
rescue Sunspot::Server::ServerError => e
  abort(e.message)
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sunspot-1.0.5 bin/sunspot-solr
sunspot-1.0.4 bin/sunspot-solr
sunspot-1.0.3 bin/sunspot-solr
sunspot-1.0.2 bin/sunspot-solr
sunspot-1.0.1 bin/sunspot-solr
sunspot-1.0.0 bin/sunspot-solr