Class: SolrWrapper::Settings
- Inherits:
-
Delegator
- Object
- Delegator
- SolrWrapper::Settings
- Defined in:
- lib/solr_wrapper/settings.rb
Overview
Configuraton that comes from static and dynamic sources.
Instance Method Summary collapse
- #__getobj__ ⇒ Object (also: #static_config)
- #__setobj__(obj) ⇒ Object
- #download_path ⇒ Object
- #download_url ⇒ Object
-
#host ⇒ Object
Get the host this Solr instance is bound to.
-
#initialize(static_config) ⇒ Settings
constructor
A new instance of Settings.
- #instance_dir ⇒ Object
- #managed? ⇒ Boolean
- #md5sum_path ⇒ Object
- #md5url ⇒ Object
-
#port ⇒ Object
Get the port this Solr instance is running at.
- #solr_binary ⇒ Object
- #tmp_save_dir ⇒ Object
-
#url ⇒ Object
Get a (likely) URL to the solr instance.
- #version_file ⇒ Object
Constructor Details
#initialize(static_config) ⇒ Settings
Returns a new instance of Settings.
17 18 19 20 |
# File 'lib/solr_wrapper/settings.rb', line 17 def initialize(static_config) super @static_config = static_config end |
Instance Method Details
#__getobj__ ⇒ Object Also known as: static_config
7 8 9 |
# File 'lib/solr_wrapper/settings.rb', line 7 def __getobj__ @static_config # return object we are delegating to, required end |
#__setobj__(obj) ⇒ Object
13 14 15 |
# File 'lib/solr_wrapper/settings.rb', line 13 def __setobj__(obj) @static_config = obj end |
#download_path ⇒ Object
55 56 57 58 |
# File 'lib/solr_wrapper/settings.rb', line 55 def download_path @download_path ||= static_config.download_path @download_path ||= default_download_path end |
#download_url ⇒ Object
50 51 52 53 |
# File 'lib/solr_wrapper/settings.rb', line 50 def download_url @download_url ||= static_config.url @download_url ||= default_download_url end |
#host ⇒ Object
Get the host this Solr instance is bound to
24 25 26 |
# File 'lib/solr_wrapper/settings.rb', line 24 def host '127.0.0.1' end |
#instance_dir ⇒ Object
41 42 43 44 |
# File 'lib/solr_wrapper/settings.rb', line 41 def instance_dir @instance_dir ||= static_config.instance_dir @instance_dir ||= File.join(Dir.tmpdir, File.basename(download_url, ".zip")) end |
#managed? ⇒ Boolean
46 47 48 |
# File 'lib/solr_wrapper/settings.rb', line 46 def managed? File.exists?(instance_dir) end |
#md5sum_path ⇒ Object
68 69 70 |
# File 'lib/solr_wrapper/settings.rb', line 68 def md5sum_path File.join(download_dir, File.basename(md5url)) end |
#md5url ⇒ Object
64 65 66 |
# File 'lib/solr_wrapper/settings.rb', line 64 def md5url "http://www.us.apache.org/dist/lucene/solr/#{static_config.version}/solr-#{static_config.version}.zip.md5" end |
#port ⇒ Object
Get the port this Solr instance is running at
30 31 32 33 |
# File 'lib/solr_wrapper/settings.rb', line 30 def port @port ||= static_config.port @port ||= random_open_port.to_s end |
#solr_binary ⇒ Object
72 73 74 |
# File 'lib/solr_wrapper/settings.rb', line 72 def solr_binary File.join(instance_dir, "bin", "solr") end |
#tmp_save_dir ⇒ Object
76 77 78 |
# File 'lib/solr_wrapper/settings.rb', line 76 def tmp_save_dir @tmp_save_dir ||= Dir.mktmpdir end |
#url ⇒ Object
Get a (likely) URL to the solr instance
37 38 39 |
# File 'lib/solr_wrapper/settings.rb', line 37 def url "http://#{host}:#{port}/solr/" end |
#version_file ⇒ Object
60 61 62 |
# File 'lib/solr_wrapper/settings.rb', line 60 def version_file static_config.version_file || File.join(instance_dir, "VERSION") end |