solr_wrapper 4.0.0 → 4.0.1
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 +1 -0
- data/lib/solr_wrapper/configuration.rb +20 -5
- data/lib/solr_wrapper/instance.rb +8 -0
- data/lib/solr_wrapper/tgz_extractor.rb +2 -24
- data/lib/solr_wrapper/version.rb +1 -1
- data/solr_wrapper.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8990953af5f4056ffa716a2d1187995684efdbeb41e3c54e7c1f6056d5875c9d
|
4
|
+
data.tar.gz: 80c77a4af17402b1a5743b263bd6ffeeaddb366d13723b64071e50035a313d16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f8e1736239ffdd87d5327743cc5baab237f56e4b90264ed87b18272a6be225e55f04bfa29fe2fd757f9be32f12a437dbed127b9ed6341fba4100ba03c30cc51
|
7
|
+
data.tar.gz: ef4b72a613031cd55d745cb57c76b26f3331e6d877e36133dd72bd859129578dbbbdce07ac05dc5415fac3e5667a73f9ad1d720c1721fda2a1ef1f1956275ac8
|
data/README.md
CHANGED
@@ -46,6 +46,7 @@ SolrWrapper.wrap port: 8983,
|
|
46
46
|
| solr_options | (Hash) |
|
47
47
|
| env | (Hash) |
|
48
48
|
| persist | (Boolean) Preserves the data in you collection between startups |
|
49
|
+
| contrib | (Array<Hash>) |
|
49
50
|
|
50
51
|
```ruby
|
51
52
|
solr.with_collection(name: 'collection_name', dir: 'path_to_solr_configs')
|
@@ -145,18 +145,22 @@ module SolrWrapper
|
|
145
145
|
|
146
146
|
def collection_options
|
147
147
|
hash = options.fetch(:collection, {})
|
148
|
-
Configuration.slice(
|
148
|
+
Configuration.slice(hash.transform_keys(&:to_sym), :name, :dir, :persist)
|
149
149
|
end
|
150
150
|
|
151
151
|
def configsets
|
152
152
|
configsets = options[:configsets] || []
|
153
|
-
configsets.map { |x|
|
153
|
+
configsets.map { |x| x.transform_keys(&:to_sym) }
|
154
154
|
end
|
155
155
|
|
156
156
|
def poll_interval
|
157
157
|
options.fetch(:poll_interval, 1)
|
158
158
|
end
|
159
159
|
|
160
|
+
def contrib
|
161
|
+
options.fetch(:contrib, [])
|
162
|
+
end
|
163
|
+
|
160
164
|
private
|
161
165
|
|
162
166
|
def self.slice(source, *keys)
|
@@ -182,11 +186,22 @@ module SolrWrapper
|
|
182
186
|
$stderr.puts "Unable to parse config #{config_file}" if verbose?
|
183
187
|
return {}
|
184
188
|
end
|
185
|
-
|
189
|
+
config.transform_keys(&:to_sym)
|
190
|
+
absoluteize_paths(config, root: File.dirname(config_file))
|
186
191
|
end
|
187
192
|
|
188
|
-
def
|
189
|
-
|
193
|
+
def absoluteize_paths(config, root: Dir.pwd)
|
194
|
+
return config unless config[:contrib]
|
195
|
+
|
196
|
+
config = config.dup
|
197
|
+
|
198
|
+
config[:contrib] = config[:contrib].map do |mapping|
|
199
|
+
mapping = mapping.transform_keys(&:to_sym)
|
200
|
+
mapping[:from] = File.expand_path(mapping[:from], root)
|
201
|
+
mapping[:to] ||= 'contrib/'
|
202
|
+
end
|
203
|
+
|
204
|
+
config
|
190
205
|
end
|
191
206
|
|
192
207
|
def default_configuration_paths
|
@@ -244,6 +244,14 @@ module SolrWrapper
|
|
244
244
|
raise_error_unless_extracted
|
245
245
|
FileUtils.cp config.solr_xml, File.join(config.instance_dir, 'server', 'solr', 'solr.xml') if config.solr_xml
|
246
246
|
FileUtils.cp_r File.join(config.extra_lib_dir, '.'), File.join(config.instance_dir, 'server', 'solr', 'lib') if config.extra_lib_dir
|
247
|
+
|
248
|
+
config.contrib.each do |mapping|
|
249
|
+
if File.directory? mapping[:from]
|
250
|
+
FileUtils.cp_r mapping[:from], File.join(config.instance_dir, mapping[:to])
|
251
|
+
else
|
252
|
+
FileUtils.cp mapping[:from], File.join(config.instance_dir, mapping[:to])
|
253
|
+
end
|
254
|
+
end
|
247
255
|
end
|
248
256
|
|
249
257
|
def extract_and_configure
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'minitar'
|
2
2
|
require 'zlib'
|
3
3
|
|
4
4
|
module SolrWrapper
|
@@ -13,29 +13,7 @@ module SolrWrapper
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def extract!
|
16
|
-
|
17
|
-
dest = nil
|
18
|
-
tar.each do |entry|
|
19
|
-
if entry.full_name == TAR_LONGLINK
|
20
|
-
dest = File.join destination, entry.read.strip
|
21
|
-
next
|
22
|
-
end
|
23
|
-
dest ||= File.join destination, entry.full_name
|
24
|
-
if entry.directory?
|
25
|
-
File.delete dest if File.file? dest
|
26
|
-
FileUtils.mkdir_p dest, mode: entry.header.mode, verbose: false
|
27
|
-
elsif entry.file?
|
28
|
-
FileUtils.rm_rf dest if File.directory? dest
|
29
|
-
File.open dest, 'wb' do |f|
|
30
|
-
f.print entry.read
|
31
|
-
end
|
32
|
-
FileUtils.chmod entry.header.mode, dest, verbose: false
|
33
|
-
elsif entry.header.typeflag == '2' # Symlink!
|
34
|
-
File.symlink entry.header.linkname, dest
|
35
|
-
end
|
36
|
-
dest = nil
|
37
|
-
end
|
38
|
-
end
|
16
|
+
Minitar.unpack(Zlib::GzipReader.open(file), destination)
|
39
17
|
rescue StandardError => e
|
40
18
|
abort "Unable to extract #{file} into #{destination}: #{e.message}"
|
41
19
|
end
|
data/lib/solr_wrapper/version.rb
CHANGED
data/solr_wrapper.gemspec
CHANGED
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: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitar
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: ruby-progressbar
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|