solr_wrapper 0.9.2 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/solr_wrapper/configuration.rb +5 -0
- data/lib/solr_wrapper/instance.rb +12 -0
- data/lib/solr_wrapper/version.rb +1 -1
- data/spec/fixtures/sample_config.yml +3 -0
- data/spec/lib/solr_wrapper/configuration_spec.rb +11 -0
- data/spec/lib/solr_wrapper/instance_spec.rb +17 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7916cf546d675d2a3f008f4a271aa4fc2cf7b8ae
|
4
|
+
data.tar.gz: 3d2e1456ff74edb606a60cef2fa1731ae5a74351
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ff2b8b312c13c8b68c233f0799c68f36761109beea56fe2648485a89be28980b53d16d5646479ce58c0575cdde11025ff9ed74b81c923eb923953dcfbcf862cf
|
7
|
+
data.tar.gz: 58a248017fd9ec7330af89ca300d686710a6c71c36d96d9af5cd1967e8c1a703be7618835d30d3f5f7066958e1046fef686f3fa2b0d2d308e3c8f4990c3963fe
|
@@ -99,6 +99,11 @@ module SolrWrapper
|
|
99
99
|
Configuration.slice(convert_keys(hash), :name, :dir)
|
100
100
|
end
|
101
101
|
|
102
|
+
def configsets
|
103
|
+
configsets = options[:configsets] || []
|
104
|
+
configsets.map { |x| convert_keys(x) }
|
105
|
+
end
|
106
|
+
|
102
107
|
def poll_interval
|
103
108
|
options.fetch(:poll_interval, 1)
|
104
109
|
end
|
@@ -77,6 +77,8 @@ module SolrWrapper
|
|
77
77
|
unless status
|
78
78
|
sleep config.poll_interval
|
79
79
|
end
|
80
|
+
|
81
|
+
after_start
|
80
82
|
end
|
81
83
|
end
|
82
84
|
|
@@ -355,6 +357,16 @@ module SolrWrapper
|
|
355
357
|
|
356
358
|
private
|
357
359
|
|
360
|
+
def after_start
|
361
|
+
create_configsets if config.cloud
|
362
|
+
end
|
363
|
+
|
364
|
+
def create_configsets
|
365
|
+
config.configsets.each do |configset|
|
366
|
+
upconfig(configset)
|
367
|
+
end
|
368
|
+
end
|
369
|
+
|
358
370
|
def extracted_version
|
359
371
|
File.read(config.version_file).strip if File.exists? config.version_file
|
360
372
|
end
|
data/lib/solr_wrapper/version.rb
CHANGED
@@ -41,4 +41,15 @@ describe SolrWrapper::Configuration do
|
|
41
41
|
expect(config.collection_options).to eq(name: 'project-development', dir: 'solr/config/')
|
42
42
|
end
|
43
43
|
end
|
44
|
+
|
45
|
+
describe '#configsets' do
|
46
|
+
before do
|
47
|
+
allow(config).to receive(:default_configuration_paths).and_return([])
|
48
|
+
end
|
49
|
+
let(:options) { { config: 'spec/fixtures/sample_config.yml' } }
|
50
|
+
|
51
|
+
it 'uses values from the config file' do
|
52
|
+
expect(config.configsets).to include(name: 'project-development-configset', dir: 'solr/config/')
|
53
|
+
end
|
54
|
+
end
|
44
55
|
end
|
@@ -7,6 +7,7 @@ describe SolrWrapper::Instance do
|
|
7
7
|
let(:client) { SimpleSolrClient::Client.new(subject.url) }
|
8
8
|
|
9
9
|
describe "#with_collection" do
|
10
|
+
let(:options) { { cloud: false } }
|
10
11
|
context "without a name" do
|
11
12
|
it "creates a new anonymous collection" do
|
12
13
|
subject.wrap do |solr|
|
@@ -51,6 +52,22 @@ describe SolrWrapper::Instance do
|
|
51
52
|
end
|
52
53
|
end
|
53
54
|
end
|
55
|
+
|
56
|
+
context 'with a config file' do
|
57
|
+
before do
|
58
|
+
allow(solr_instance.config).to receive(:configsets)
|
59
|
+
.and_return([name: 'project-development', dir: 'solr/config/'])
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'creates a new configsets with options from the config' do
|
63
|
+
expect(subject).to receive(:upconfig).with(
|
64
|
+
hash_including(name: 'project-development', dir: anything))
|
65
|
+
|
66
|
+
subject.wrap do
|
67
|
+
# no-op
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
54
71
|
end
|
55
72
|
|
56
73
|
describe 'exec' do
|