solr_wrapper 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/README.md +27 -0
- data/Rakefile +6 -0
- data/coveralls.yml +1 -0
- data/lib/solr_wrapper/instance.rb +5 -7
- data/lib/solr_wrapper/version.rb +1 -1
- data/solr_wrapper.gemspec +2 -1
- data/spec/lib/solr_wrapper/instance_spec.rb +1 -1
- data/spec/lib/solr_wrapper_spec.rb +2 -2
- data/spec/spec_helper.rb +4 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 236a1eced6b831ca9b182fb6a69031495567acd7
|
4
|
+
data.tar.gz: e053e51b06aad6e8420675b1b7718c259fa98c64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74b2782c628c9fc4903dec66dd405a66cf01212ee126ac768325745f6ee6c5d22b7772facb0c28f7f82d2cfeb24634c3faccdec24d27b76c84d324f1a47de5ed
|
7
|
+
data.tar.gz: b81687cee34cdc5feeffbf3fea6868c08aff80cfd664e9e88b4cf252ae18cb1f435406373b7ae322c57840a0eb3c7d6c637b7211afb5fefe794f8d3cc6a95c86
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1 +1,28 @@
|
|
1
1
|
# solrwrapper
|
2
|
+
|
3
|
+
Wrap any task with a Solr instance:
|
4
|
+
|
5
|
+
```ruby
|
6
|
+
SolrWrapper.wrap do |solr|
|
7
|
+
# Something that requires Solr
|
8
|
+
end
|
9
|
+
```
|
10
|
+
|
11
|
+
Or with Solr and a solr collection:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
subject.wrap do |solr|
|
15
|
+
solr.with_collection(dir: File.join(FIXTURES_DIR, "basic_configs")) do |collection_name|
|
16
|
+
end
|
17
|
+
end
|
18
|
+
```
|
19
|
+
|
20
|
+
## Basic Options
|
21
|
+
|
22
|
+
```ruby
|
23
|
+
SolrWrapper.wrap port: 8983, verbose: true, managed: true
|
24
|
+
```
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
solr.with_collection(name: 'collection_name', dir: 'path_to_solr_confiigs')
|
28
|
+
```
|
data/Rakefile
CHANGED
data/coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'digest'
|
2
2
|
require 'fileutils'
|
3
3
|
require 'open-uri'
|
4
|
-
require 'progressbar'
|
4
|
+
require 'ruby-progressbar'
|
5
5
|
require 'securerandom'
|
6
6
|
require 'tmpdir'
|
7
7
|
require 'zip'
|
@@ -77,15 +77,14 @@ module SolrWrapper
|
|
77
77
|
|
78
78
|
def download
|
79
79
|
unless File.exists? download_path and md5sum(download_path) == expected_md5sum
|
80
|
-
pbar = ProgressBar.
|
80
|
+
pbar = ProgressBar.create(title: File.basename(url), total: nil, format: "%t: |%B| %p%% (%e )")
|
81
81
|
open(url, content_length_proc: lambda {|t|
|
82
82
|
if t && 0 < t
|
83
83
|
pbar.total = t
|
84
|
-
pbar.file_transfer_mode
|
85
84
|
end
|
86
85
|
},
|
87
86
|
progress_proc: lambda {|s|
|
88
|
-
pbar.
|
87
|
+
pbar.progress = s
|
89
88
|
}) do |io|
|
90
89
|
IO.copy_stream(io,download_path)
|
91
90
|
end
|
@@ -142,15 +141,14 @@ module SolrWrapper
|
|
142
141
|
|
143
142
|
def md5file
|
144
143
|
unless File.exists? md5sum_path
|
145
|
-
pbar = ProgressBar.
|
144
|
+
pbar = ProgressBar.create(title: File.basename(md5url), total: nil, format: "%t: |%B| %p%% (%e )")
|
146
145
|
open(md5url, content_length_proc: lambda {|t|
|
147
146
|
if t && 0 < t
|
148
147
|
pbar.total = t
|
149
|
-
pbar.file_transfer_mode
|
150
148
|
end
|
151
149
|
},
|
152
150
|
progress_proc: lambda {|s|
|
153
|
-
pbar.
|
151
|
+
pbar.progress = s
|
154
152
|
}) do |io|
|
155
153
|
IO.copy_stream(io, md5sum_path)
|
156
154
|
end
|
data/lib/solr_wrapper/version.rb
CHANGED
data/solr_wrapper.gemspec
CHANGED
@@ -18,11 +18,12 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
20
|
spec.add_dependency "rubyzip"
|
21
|
-
spec.add_dependency "progressbar"
|
21
|
+
spec.add_dependency "ruby-progressbar"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.7"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
25
|
|
26
26
|
spec.add_development_dependency "rspec"
|
27
27
|
spec.add_development_dependency "simple_solr_client"
|
28
|
+
spec.add_development_dependency "coveralls"
|
28
29
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe SolrWrapper::Instance do
|
4
|
-
subject { SolrWrapper::Instance.new
|
4
|
+
subject { SolrWrapper::Instance.new }
|
5
5
|
let(:client) { SimpleSolrClient::Client.new("http://localhost:#{subject.port}/solr/") }
|
6
6
|
describe "#with_collection" do
|
7
7
|
it "should create a new anonymous collection" do
|
@@ -3,8 +3,8 @@ require 'spec_helper'
|
|
3
3
|
describe SolrWrapper do
|
4
4
|
describe ".wrap" do
|
5
5
|
it "should launch solr" do
|
6
|
-
SolrWrapper.wrap do |solr|
|
7
|
-
expect(Timeout::timeout(
|
6
|
+
SolrWrapper.wrap(download_path: './tmp') do |solr|
|
7
|
+
expect(Timeout::timeout(15) do
|
8
8
|
begin
|
9
9
|
s = TCPSocket.new('127.0.0.1', solr.port)
|
10
10
|
s.close
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: solr_wrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: progressbar
|
28
|
+
name: ruby-progressbar
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -94,6 +94,20 @@ dependencies:
|
|
94
94
|
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: coveralls
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
97
111
|
description:
|
98
112
|
email:
|
99
113
|
- chris@cbeer.info
|
@@ -102,10 +116,12 @@ extensions: []
|
|
102
116
|
extra_rdoc_files: []
|
103
117
|
files:
|
104
118
|
- ".gitignore"
|
119
|
+
- ".travis.yml"
|
105
120
|
- Gemfile
|
106
121
|
- LICENSE
|
107
122
|
- README.md
|
108
123
|
- Rakefile
|
124
|
+
- coveralls.yml
|
109
125
|
- lib/solr_wrapper.rb
|
110
126
|
- lib/solr_wrapper/instance.rb
|
111
127
|
- lib/solr_wrapper/version.rb
|