Sha256: 7d686518776160320ead67e2da899f8857b5533c55d013e3ced537ace1292393

Contents?: true

Size: 1.73 KB

Versions: 18

Compression:

Stored size: 1.73 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 '-j', '--solr-jar=JAR', 'Solr start jar' do |j|
    server.solr_jar = File.expand_path(j)
  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

18 entries across 18 versions & 6 rubygems

Version Path
erichummel-sunspot-1.2.1g bin/sunspot-solr
erichummel-sunspot-1.2.1f bin/sunspot-solr
erichummel-sunspot-1.2.1b bin/sunspot-solr
erichummel-sunspot-1.2.1a bin/sunspot-solr
erichummel-sunspot-1.2.1 bin/sunspot-solr
lisausa-sunspot-1.2.1.1 bin/sunspot-solr
lisausa-sunspot-1.2.1 bin/sunspot-solr
sunspot_rbg-1.3.1 bin/sunspot-solr
sunspot_rbg-1.3.0 bin/sunspot-solr
ruben-sunspot-1.1.4 bin/sunspot-solr
ruben-sunspot-1.1.3 bin/sunspot-solr
ruben-sunspot-1.1.2 bin/sunspot-solr
sunspot-1.2.1 bin/sunspot-solr
sunspot-1.2.0 bin/sunspot-solr
ruben-sunspot-1.1.1 bin/sunspot-solr
ruben-sunspot-1.1.0 bin/sunspot-solr
nuatt_sunspot-1.1.0.3 bin/sunspot-solr
sunspot-1.1.0 bin/sunspot-solr