solr_wrapper 0.23.0 → 1.0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97965764f9ff8aa0d2d5a1fbffa2b7c055035dde
4
- data.tar.gz: 6bedb619fab3f16e6eecae2285aa75b8c0971491
3
+ metadata.gz: '092270d968ea024833bc6185caf854c05c8e623e'
4
+ data.tar.gz: 83d3dd71ca0de7c18ee9090a06ff051b174dbf4a
5
5
  SHA512:
6
- metadata.gz: e92a5c190dc5341f7f43d2f832cd9bed1ddc5304ce15d9c6300919517e8b89b4c458d37bd8e85d9f4c49905f2a585d221a8c03195a2f17592f263f735691e9ac
7
- data.tar.gz: cb358c689526083d2f7e9e6e2c8ce525f751d74d47fbc6a3a4957dcd765306f085fcd5619765a6558ec40fae3e73acc71cc3107a865dfb598bc6780cc750e058
6
+ metadata.gz: c4da5d83939b7d10b089d4453b79fb778aa499809cbd114d634fe8e7e790a21896c73320055fa43d3682559768fcb5729f2062bde7ab1ee9beeb92e967c1cf50
7
+ data.tar.gz: c7373e52dcd5520e541947655b1e95c6fcd53e9ccf7b356d7bf2efa37f60bb36555508451bc46546c92b3b1899859040453072802e54ba9fd59238fed106553d
@@ -1,12 +1,13 @@
1
1
  language: ruby
2
2
  sudo: false
3
3
  rvm:
4
- - 2.2.5
5
- - 2.3.1
6
- - jruby-9.1.0.0
7
- cache:
8
- directories:
9
- - /tmp/solr-5.4.1
4
+ - 2.4.1
5
+ - 2.3.4
6
+ - jruby-9.1.8.0
10
7
 
11
8
  jdk:
12
- - oraclejdk8
9
+ - oraclejdk8
10
+
11
+ env:
12
+ global:
13
+ JRUBY_OPTS=-J-Xmx2g
@@ -8,7 +8,7 @@ require 'solr_wrapper/client'
8
8
 
9
9
  module SolrWrapper
10
10
  def self.default_solr_version
11
- '6.5.0'
11
+ 'latest'
12
12
  end
13
13
 
14
14
  def self.default_solr_port
@@ -1,3 +1,5 @@
1
+ require 'faraday'
2
+
1
3
  module SolrWrapper
2
4
  class Configuration
3
5
  attr_reader :options
@@ -77,7 +79,14 @@ module SolrWrapper
77
79
  end
78
80
 
79
81
  def version
80
- @version ||= options.fetch(:version, SolrWrapper.default_instance_options[:version])
82
+ @version ||= begin
83
+ config_version = options.fetch(:version, SolrWrapper.default_instance_options[:version])
84
+ if config_version == 'latest'
85
+ fetch_latest_version
86
+ else
87
+ config_version
88
+ end
89
+ end
81
90
  end
82
91
 
83
92
  def mirror_url
@@ -145,5 +154,10 @@ module SolrWrapper
145
154
  def default_configuration_paths
146
155
  ['~/.solr_wrapper.yml', '~/.solr_wrapper', '.solr_wrapper.yml', '.solr_wrapper']
147
156
  end
157
+
158
+ def fetch_latest_version
159
+ response = Faraday.get('https://svn.apache.org/repos/asf/lucene/cms/trunk/content/latestversion.mdtext')
160
+ response.body.strip
161
+ end
148
162
  end
149
163
  end
@@ -1,3 +1,3 @@
1
1
  module SolrWrapper
2
- VERSION = '0.23.0'
2
+ VERSION = '1.0.0'
3
3
  end
@@ -28,5 +28,5 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency "rspec"
29
29
  spec.add_development_dependency "simple_solr_client"
30
30
  spec.add_development_dependency "coveralls"
31
- spec.add_development_dependency "fakeweb"
31
+ spec.add_development_dependency "webmock"
32
32
  end
@@ -5,18 +5,18 @@ describe SolrWrapper::Client do
5
5
 
6
6
  describe '#exists?' do
7
7
  it 'checks if a solrcloud collection exists' do
8
- FakeWeb.register_uri(:get, 'http://localhost:8983/solr/admin/collections?action=LIST&wt=json', body: '{ "collections": ["x", "y", "z"]}')
9
- FakeWeb.register_uri(:get, 'http://localhost:8983/solr/admin/cores?action=STATUS&wt=json&core=a', body: '{ "status": { "a": {} } }')
8
+ stub_request(:get, 'http://localhost:8983/solr/admin/collections?action=LIST&wt=json').to_return(body: '{ "collections": ["x", "y", "z"]}')
9
+ stub_request(:get, 'http://localhost:8983/solr/admin/cores?action=STATUS&wt=json&core=a').to_return(body: '{ "status": { "a": {} } }')
10
10
 
11
11
  expect(subject.exists?('x')).to eq true
12
12
  expect(subject.exists?('a')).to eq false
13
13
  end
14
14
 
15
15
  it 'checks if a solr core exists' do
16
- FakeWeb.register_uri(:get, 'http://localhost:8983/solr/admin/collections?action=LIST&wt=json', body: '{ "error": { "msg": "Solr instance is not running in SolrCloud mode."} }')
16
+ stub_request(:get, 'http://localhost:8983/solr/admin/collections?action=LIST&wt=json').to_return(body: '{ "error": { "msg": "Solr instance is not running in SolrCloud mode."} }')
17
17
 
18
- FakeWeb.register_uri(:get, 'http://localhost:8983/solr/admin/cores?action=STATUS&wt=json&core=x', body: '{ "status": { "x": { "name": "x" } } }')
19
- FakeWeb.register_uri(:get, 'http://localhost:8983/solr/admin/cores?action=STATUS&wt=json&core=a', body: '{ "status": { "a": {} } }')
18
+ stub_request(:get, 'http://localhost:8983/solr/admin/cores?action=STATUS&wt=json&core=x').to_return(body: '{ "status": { "x": { "name": "x" } } }')
19
+ stub_request(:get, 'http://localhost:8983/solr/admin/cores?action=STATUS&wt=json&core=a').to_return(body: '{ "status": { "a": {} } }')
20
20
 
21
21
  expect(subject.exists?('x')).to eq true
22
22
  expect(subject.exists?('a')).to eq false
@@ -61,4 +61,26 @@ describe SolrWrapper::Configuration do
61
61
  expect(config.configsets).to include(name: 'project-development-configset', dir: 'solr/config/')
62
62
  end
63
63
  end
64
+
65
+ describe '#version' do
66
+ context 'when it is a version number' do
67
+ let(:options) { { version: 'x.y.z' } }
68
+
69
+ it 'uses that version' do
70
+ expect(config.version).to eq 'x.y.z'
71
+ end
72
+ end
73
+
74
+ context 'when it is "latest"' do
75
+ let(:options) { { version: 'latest'} }
76
+
77
+ before do
78
+ stub_request(:get, 'https://svn.apache.org/repos/asf/lucene/cms/trunk/content/latestversion.mdtext').to_return(body: 'z.y.x')
79
+ end
80
+
81
+ it 'fetches the latest version number from apache' do
82
+ expect(config.version).to eq 'z.y.x'
83
+ end
84
+ end
85
+ end
64
86
  end
@@ -5,7 +5,9 @@ require 'solr_wrapper'
5
5
  require 'simple_solr_client'
6
6
 
7
7
  require 'rspec'
8
- require 'fakeweb'
8
+ require 'webmock/rspec'
9
+
10
+ WebMock.allow_net_connect!
9
11
 
10
12
  FIXTURES_DIR = File.expand_path("fixtures", File.dirname(__FILE__))
11
13
 
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.23.0
4
+ version: 1.0.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: 2017-03-27 00:00:00.000000000 Z
11
+ date: 2017-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -123,7 +123,7 @@ dependencies:
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
- name: fakeweb
126
+ name: webmock
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
129
  - - ">="
@@ -202,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
202
  version: '0'
203
203
  requirements: []
204
204
  rubyforge_project:
205
- rubygems_version: 2.6.10
205
+ rubygems_version: 2.6.8
206
206
  signing_key:
207
207
  specification_version: 4
208
208
  summary: Solr 5 service wrapper