Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ SolrWrapper.wrap port: 8983,
| solr_options | (Hash) |
| env | (Hash) |
| persist | (Boolean) Preserves the data in you collection between startups |

| print_config | (boolean) |
```ruby
solr.with_collection(name: 'collection_name', dir: 'path_to_solr_configs')
```
Expand Down
10 changes: 10 additions & 0 deletions exe/solr_wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ args = OptionParser.new do |opts|
options[:verbose] = v
end

opts.on("--print-config", "Print the configuration parameters") do |d|
options[:print_config] = true
end

opts.on("--config FILE", "Load configuration from a file") do |v|
options[:config] = v
end
Expand Down Expand Up @@ -98,6 +102,12 @@ end

instance = SolrWrapper.instance(options)

if options[:print_config]
$stderr.puts '### solr_wrapper configuration ###'
$stderr.puts instance.config.to_yaml
$stderr.puts '#####'
end

case command
when 'clean'
if instance.started?
Expand Down
4 changes: 4 additions & 0 deletions lib/solr_wrapper/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ def poll_interval
options.fetch(:poll_interval, 1)
end

def tmp_save_dir
options[:tmp_save_dir]
end

private

def self.slice(source, *keys)
Expand Down
22 changes: 21 additions & 1 deletion lib/solr_wrapper/settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,33 @@ def initialize(static_config)
@static_config = static_config
end

def to_yaml(*args)
static_config.options.merge({
version: version,
verbose: verbose?,
download_dir: download_dir,
host: host,
zookeeper_host: zookeeper_host,
port: port,
zookeeper_port: zookeeper_port,
url: url,
instance_dir: instance_dir,
download_url: download_url,
solr_zip_path: solr_zip_path,
version_file: version_file,
mirror_url: default_download_url.gsub(%r{/lucene/solr.*}, ''),
tmp_save_dir: tmp_save_dir
}).to_yaml(*args)
end

##
# Get the host this Solr instance is bound to
def host
'127.0.0.1'
end

def zookeeper_host
@zookeeper_host ||= static_config.zookeeper_port
@zookeeper_host ||= static_config.zookeeper_host
@zookeeper_host ||= host
end

Expand Down Expand Up @@ -77,6 +96,7 @@ def solr_binary
end

def tmp_save_dir
@tmp_save_dir ||= static_config.tmp_save_dir
@tmp_save_dir ||= Dir.mktmpdir
end

Expand Down