solr_wrapper 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3991dd503c5902e6012328a4663edff78f669fbf
4
- data.tar.gz: 7d17c2fcc21fa1e370a4903c393de8b3ae207f76
3
+ metadata.gz: 58da2cf39d47b880c7b1b3adbf446cb9e5d3dece
4
+ data.tar.gz: c1603b745a74afc2ab39a9ac8fd48954a17c51e3
5
5
  SHA512:
6
- metadata.gz: 650abf178f6f41be0f6a96c01699edbdee09a82d6bcca41223ce0c185524bc0d59ec549c669232abab75e85ce187bdb03acf759f94033b0fb2cdd2071b0e1a99
7
- data.tar.gz: 29f4b23edfee5ee869b1626c0f88775468106dff2ae5a2059ef1d805cc3d7f03e76d9c285f9e0822583026190160db0d1ae8a361745b8b45a599e70d01f35e1a
6
+ metadata.gz: 15233b1419a26bb1914d1826e4f5dcf46044c50a48a0d5693b05af257e7163bca147253ee4c9ee7565afbeec9b65a7d5e22790fddd41e1d01b09f00e8673c8a3
7
+ data.tar.gz: 9bd88c7b5fffb1f84ef5024cab91be4daf30732e30345fbec3eb7597f2048e233bcac6d5933c7122923b79020890b9f6f81ba59db2b0d2d76a862816f28fa7b3
@@ -2,20 +2,18 @@ module SolrWrapper
2
2
  class ChecksumValidator
3
3
  attr_reader :config
4
4
 
5
- ALGORITHM = 'sha1'
6
-
7
5
  def initialize(config)
8
6
  @config = config
9
7
  end
10
8
 
11
9
  def clean!
12
- path = checksum_path(ALGORITHM)
10
+ path = checksum_path(algorithm)
13
11
  FileUtils.remove_entry(path) if File.exist? path
14
12
  end
15
13
 
16
14
  def validate?(file)
17
15
  return true if config.validate == false
18
- Digest.const_get(ALGORITHM.upcase).file(file).hexdigest == expected_sum(ALGORITHM)
16
+ Digest.const_get(algorithm.upcase).file(file).hexdigest == expected_sum(algorithm)
19
17
  end
20
18
 
21
19
  def validate!(file)
@@ -53,5 +51,12 @@ module SolrWrapper
53
51
  end
54
52
  path
55
53
  end
54
+
55
+ def algorithm
56
+ return config.static_config.algorithm if config.static_config.algorithm
57
+ return 'sha1' if config.static_config.version =~ /^[1-6]/ || config.static_config.version =~ /^[7]\.[0-4]/
58
+
59
+ 'sha512'
60
+ end
56
61
  end
57
62
  end
@@ -31,6 +31,10 @@ module SolrWrapper
31
31
  options[:checksum]
32
32
  end
33
33
 
34
+ def algorithm
35
+ options[:algorithm]
36
+ end
37
+
34
38
  def url
35
39
  options[:url]
36
40
  end
@@ -1,3 +1,3 @@
1
1
  module SolrWrapper
2
- VERSION = '2.0.0'
2
+ VERSION = '2.1.0'
3
3
  end
@@ -83,7 +83,8 @@ describe SolrWrapper::Instance do
83
83
  solr.downconfig name: config_name, dir: dir
84
84
  end
85
85
  solr.with_collection(config_name: config_name) do |collection_name|
86
- core = client.core(collection_name)
86
+ core_name = client.cores.select { |x| x =~ /^#{collection_name}/ }.first
87
+ core = client.core(core_name)
87
88
  unless defined? JRUBY_VERSION
88
89
  expect(core.all.size).to eq 0
89
90
  end
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: 2.0.0
4
+ version: 2.1.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: 2018-06-27 00:00:00.000000000 Z
11
+ date: 2018-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday