Module: SolrSail
- Defined in:
- lib/solr_sail.rb,
lib/solr_sail/cli.rb,
lib/solr_sail/version.rb
Overview
:title:SolrSail
Handles extracting the config and running an instance of Solr
Authors
Michael Guymon
Defined Under Namespace
Classes: CLI
Constant Summary collapse
- DEFAULT_JAR_NAME =
"solr_sail-#{SolrSail::VERSION}.jar"
- DEFAULT_JAR =
File.("#{File.dirname(__FILE__)}/../#{DEFAULT_JAR_NAME}")
- DEFAULT_LOCKFILE =
File.("#{File.dirname(__FILE__)}/../Jarfile.lock")
- VERSION =
VERSION file not found in gem dir, assume running from checkout
IO.read(File.("VERSION")).strip
Class Method Summary collapse
-
.install_config(opts) ⇒ Object
Extract the configuration files for Solr.
-
.install_jars(opts = {}) ⇒ Object
Install Jar dependencies, should be called by the Gem.post_install.
-
.start(opts) ⇒ Object
Start Solr.
Class Method Details
.install_config(opts) ⇒ Object
Extract the configuration files for Solr
opts:
* :jar: path to the solr_sail jar, default to jar packaged with the gem
* :lockfile: path to lockfile that contains the jar dependencies, defaults to Jarfile.lock packaged with the gem
* :solr_home: path to solr home, defaults to 'solr'
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/solr_sail.rb', line 36 def self.install_config( opts ) opts = { :solr_home => 'solr', :jar => DEFAULT_JAR, :lockfile => DEFAULT_LOCKFILE }.merge( opts ) lockfile = opts.delete(:lockfile) jar = opts.delete(:jar) # XXX: should use LockJar to prevent duplicates in the classpath $CLASSPATH << File.( jar ) # XXX: need a safer way to pass opts to LockJar LockJar.load( lockfile, opts ) solr_config = com.tobedevoured.solrsail.SolrConfig.new( opts[:solr_home] ) solr_config.install() end |
.install_jars(opts = {}) ⇒ Object
Install Jar dependencies, should be called by the Gem.post_install
23 24 25 26 27 |
# File 'lib/solr_sail.rb', line 23 def self.install_jars( opts ={} ) opts = {:lockfile => DEFAULT_LOCKFILE }.merge( opts ) lockfile = opts.delete(:lockfile) LockJar.install( lockfile, opts ) end |
.start(opts) ⇒ Object
Start Solr
The server is configued by solr_sail.conf loaded from the solr home. The opts passed in override solr_sail.conf
opts:
* :context_path: context path solr runs under, defaults to /solr
* :jar: path to the solr_sail jar, default to jar packaged with the gem
* :join: have the server join the thread. Defaults to false
* :lockfile: path to lockfile that contains the jar dependencies, defaults to Jarfile.lock packaged with the gem
* :port: the port solr runs on, defaults to 8983
* :solr_home: path to solr home, defaults to 'solr'
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/solr_sail.rb', line 65 def self.start( opts ) opts = { :solr_home => 'solr', :jar => DEFAULT_JAR, :lockfile => DEFAULT_LOCKFILE, :join => false }.merge( opts ) lockfile = opts.delete(:lockfile) jar = opts.delete(:jar) # XXX: should use LockJar to prevent duplicates in the classpath $CLASSPATH << File.( jar ) # XXX: need a safer way to pass opts to LockJar LockJar.load( lockfile, opts ) jetty = com.tobedevoured.solrsail.JettyServer.new( opts[:solr_home] ) if opts[:port] jetty.setPort( opts[:port] ) end if opts[:context_path] jetty.setContextPath(opts[:context_path]) end jetty.start(opts[:join]) jetty end |