Sha256: 4f9668243df8ea04ebf1e694ad6feb5e8d0315ab31eff28ac37632e47e2d8244

Contents?: true

Size: 1.41 KB

Versions: 4

Compression:

Stored size: 1.41 KB

Contents

#!/usr/bin/env ruby

require 'solr_wrapper'
require 'optparse'

options = {}
collection_options = {}
OptionParser.new do |opts|
  opts.banner = "Usage: solr_wrapper [options]"

  opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
    options[:verbose] = v
  end

  opts.on("--version VERSION", "Specify a Solr version to download (default: #{SolrWrapper.default_solr_version})") do |v|
    options[:version] = v
  end

  opts.on("-pPORT", "--port PORT", "Specify the port Solr should run at (default: 8983)") do |p|
    options[:port] = p
  end

  opts.on("-c", "--cloud", "Run solr in cloud mode") do |c|
    options[:cloud] = c
  end

  opts.on("-iDIR", "--instance_directory DIR", "Install/use solr at the given directory") do |d|
    options[:instance_dir] = d
  end

  opts.on("-lDIR", "--lib_directory DIR", "Grab extra libs from this directory") do |d|
    options[:extra_lib_dir] = d
  end

  opts.on("-nNAME", "--collection_name NAME", "Create a default solr collection with the given name") do |c|
    collection_options[:name] = c
  end

  opts.on("-dDIR", "--collection_config DIR", "Create a default solr collection with the files from the given directory") do |d|
    collection_options[:dir] = d
  end

end.parse!

# default to verbose
options[:verbose] = true if options[:verbose].nil?

SolrWrapper.wrap(options) do |conn|
  conn.with_collection(collection_options) do
    while conn.status
      sleep 1
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solr_wrapper-0.4.2 exe/solr_wrapper
solr_wrapper-0.4.1 exe/solr_wrapper
solr_wrapper-0.4.0 exe/solr_wrapper
solr_wrapper-0.3.0 exe/solr_wrapper