solr_wrapper 0.10.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/exe/solr_wrapper +6 -2
- data/lib/solr_wrapper/configuration.rb +3 -3
- data/lib/solr_wrapper/instance.rb +8 -8
- data/lib/solr_wrapper/settings.rb +4 -4
- data/lib/solr_wrapper/tasks/solr_wrapper.rake +2 -2
- data/lib/solr_wrapper/version.rb +1 -1
- data/spec/fixtures/sample_config.yml +1 -0
- data/spec/lib/solr_wrapper/configuration_spec.rb +1 -1
- data/spec/lib/solr_wrapper/instance_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e09bf11e0bdc4b5b491f07d8a186d1a7b8a5f114
|
4
|
+
data.tar.gz: 7624c4541d2769a337b2388a5613b97223f4422d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e39cd0114a9e4c0811d29507e111daebc58a10ac669ee2e83accc7730670ef77fd274522acdd128c5737e90729c969d39c4426dafe237c30c2ba5b941bab37e
|
7
|
+
data.tar.gz: 9a293c7571d72fc9b107bacf127bc6bc9b81872fd0726650699a3c72ea80a484bd7d779edcaaa52ec39e29c0165af9b524826958aa6204bef082ac832fe5eeb5
|
data/README.md
CHANGED
@@ -35,7 +35,8 @@ Options:
|
|
35
35
|
| version | Solr version to download and install |
|
36
36
|
| port | port to run Solr on |
|
37
37
|
| version_file | Local path to store the currently installed version |
|
38
|
-
|
|
38
|
+
| download_dir | Local path for storing the downloaded Solr zip file |
|
39
|
+
| solr_zip_path | Local path to the Solr zip file |
|
39
40
|
| md5sum | Path/URL to MD5 checksum |
|
40
41
|
| solr_xml | Path to Solr configuration |
|
41
42
|
| verbose | (Boolean) |
|
data/exe/solr_wrapper
CHANGED
@@ -32,8 +32,8 @@ args = OptionParser.new do |opts|
|
|
32
32
|
options[:cloud] = c
|
33
33
|
end
|
34
34
|
|
35
|
-
opts.on("--
|
36
|
-
options[:
|
35
|
+
opts.on("--solr_zip_path PATH", "Download/use solr at the given path") do |d|
|
36
|
+
options[:solr_zip_path] = d
|
37
37
|
end
|
38
38
|
|
39
39
|
opts.on("-iDIR", "--instance_directory DIR", "Install/use solr at the given directory") do |d|
|
@@ -52,6 +52,10 @@ args = OptionParser.new do |opts|
|
|
52
52
|
collection_options[:dir] = d
|
53
53
|
end
|
54
54
|
|
55
|
+
opts.on("--[no-]persist", "Persist the solr connection data") do |d|
|
56
|
+
collection_options[:persist] = d
|
57
|
+
end
|
58
|
+
|
55
59
|
opts.on("--no-checksum", "Skip running checksum validation on the downloaded file") do |d|
|
56
60
|
options[:ignore_md5sum] = true
|
57
61
|
end
|
@@ -46,8 +46,8 @@ module SolrWrapper
|
|
46
46
|
options[:zookeeper_port]
|
47
47
|
end
|
48
48
|
|
49
|
-
def
|
50
|
-
options[:
|
49
|
+
def solr_zip_path
|
50
|
+
options[:solr_zip_path]
|
51
51
|
end
|
52
52
|
|
53
53
|
def download_dir
|
@@ -96,7 +96,7 @@ module SolrWrapper
|
|
96
96
|
|
97
97
|
def collection_options
|
98
98
|
hash = options.fetch(:collection, {})
|
99
|
-
Configuration.slice(convert_keys(hash), :name, :dir)
|
99
|
+
Configuration.slice(convert_keys(hash), :name, :dir, :persist)
|
100
100
|
end
|
101
101
|
|
102
102
|
def configsets
|
@@ -22,8 +22,8 @@ module SolrWrapper
|
|
22
22
|
# @option options [String] :port port to run Solr on
|
23
23
|
# @option options [Boolean] :cloud Run solr in cloud mode
|
24
24
|
# @option options [String] :version_file Local path to store the currently installed version
|
25
|
-
# @option options [String] :download_dir Local directory to store the downloaded Solr zip and its md5 file in (overridden by :
|
26
|
-
# @option options [String] :
|
25
|
+
# @option options [String] :download_dir Local directory to store the downloaded Solr zip and its md5 file in (overridden by :solr_zip_path)
|
26
|
+
# @option options [String] :solr_zip_path Local path for storing the downloaded Solr zip file
|
27
27
|
# @option options [Boolean] :validate Should solr_wrapper download a new md5 and (re-)validate the zip file? (default: trueF)
|
28
28
|
# @option options [String] :md5sum Path/URL to MD5 checksum
|
29
29
|
# @option options [String] :solr_xml Path to Solr configuration
|
@@ -208,7 +208,7 @@ module SolrWrapper
|
|
208
208
|
begin
|
209
209
|
yield name
|
210
210
|
ensure
|
211
|
-
delete name
|
211
|
+
delete name unless options[:persist]
|
212
212
|
end
|
213
213
|
end
|
214
214
|
|
@@ -217,7 +217,7 @@ module SolrWrapper
|
|
217
217
|
def clean!
|
218
218
|
stop
|
219
219
|
remove_instance_dir!
|
220
|
-
FileUtils.remove_entry(config.
|
220
|
+
FileUtils.remove_entry(config.download_dir, true) if File.exists?(config.download_dir)
|
221
221
|
FileUtils.remove_entry(config.tmp_save_dir, true) if File.exists? config.tmp_save_dir
|
222
222
|
md5.clean!
|
223
223
|
FileUtils.remove_entry(config.version_file) if File.exists? config.version_file
|
@@ -285,11 +285,11 @@ module SolrWrapper
|
|
285
285
|
end
|
286
286
|
|
287
287
|
def download
|
288
|
-
unless File.exists?(config.
|
289
|
-
Downloader.fetch_with_progressbar config.download_url, config.
|
290
|
-
md5.validate! config.
|
288
|
+
unless File.exists?(config.solr_zip_path) && md5.validate?(config.solr_zip_path)
|
289
|
+
Downloader.fetch_with_progressbar config.download_url, config.solr_zip_path
|
290
|
+
md5.validate! config.solr_zip_path
|
291
291
|
end
|
292
|
-
config.
|
292
|
+
config.solr_zip_path
|
293
293
|
end
|
294
294
|
|
295
295
|
##
|
@@ -63,9 +63,9 @@ module SolrWrapper
|
|
63
63
|
@download_url ||= default_download_url
|
64
64
|
end
|
65
65
|
|
66
|
-
def
|
67
|
-
@
|
68
|
-
@
|
66
|
+
def solr_zip_path
|
67
|
+
@solr_zip_path ||= static_config.solr_zip_path
|
68
|
+
@solr_zip_path ||= default_solr_zip_path
|
69
69
|
end
|
70
70
|
|
71
71
|
def version_file
|
@@ -90,7 +90,7 @@ module SolrWrapper
|
|
90
90
|
|
91
91
|
private
|
92
92
|
|
93
|
-
def
|
93
|
+
def default_solr_zip_path
|
94
94
|
File.join(download_dir, File.basename(download_url))
|
95
95
|
end
|
96
96
|
|
@@ -4,7 +4,7 @@ require 'solr_wrapper'
|
|
4
4
|
namespace :solr do
|
5
5
|
desc "Load the solr options and solr instance"
|
6
6
|
task :environment do
|
7
|
-
@solr_instance = SolrWrapper.
|
7
|
+
@solr_instance = SolrWrapper.default_instance
|
8
8
|
end
|
9
9
|
|
10
10
|
desc 'Install a clean version of solr. Replaces the existing copy if there is one.'
|
@@ -17,7 +17,7 @@ namespace :solr do
|
|
17
17
|
desc 'start solr'
|
18
18
|
task start: :environment do
|
19
19
|
begin
|
20
|
-
puts "Starting solr at #{
|
20
|
+
puts "Starting solr at #{@solr_instance.config.url}"
|
21
21
|
@solr_instance.start
|
22
22
|
rescue => e
|
23
23
|
if e.message.include?("Port #{@solr_instance.port} is already being used by another process")
|
data/lib/solr_wrapper/version.rb
CHANGED
@@ -38,7 +38,7 @@ describe SolrWrapper::Configuration do
|
|
38
38
|
end
|
39
39
|
let(:options) { { config: 'spec/fixtures/sample_config.yml' } }
|
40
40
|
it "uses values from the config file" do
|
41
|
-
expect(config.collection_options).to eq(name: 'project-development', dir: 'solr/config/')
|
41
|
+
expect(config.collection_options).to eq(name: 'project-development', dir: 'solr/config/', persist: false)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -34,6 +34,15 @@ describe SolrWrapper::Instance do
|
|
34
34
|
solr_instance.with_collection(dir: File.join(FIXTURES_DIR, "basic_configs")) {}
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
context 'persistent collections' do
|
39
|
+
it "creates a new collection with options from the config" do
|
40
|
+
expect(solr_instance).to receive(:create).with(
|
41
|
+
hash_including(name: 'project-development'))
|
42
|
+
expect(solr_instance).not_to receive(:delete)
|
43
|
+
solr_instance.with_collection(name: 'project-development', dir: 'solr/config/', persist: true) {}
|
44
|
+
end
|
45
|
+
end
|
37
46
|
end
|
38
47
|
|
39
48
|
context 'with a SolrCloud instance' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solr_wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04
|
11
|
+
date: 2016-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|