solr_wrapper 0.7.3 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/lib/solr_wrapper.rb +1 -1
- data/lib/solr_wrapper/downloader.rb +15 -9
- data/lib/solr_wrapper/instance.rb +0 -1
- data/lib/solr_wrapper/version.rb +1 -1
- data/spec/lib/solr_wrapper/instance_spec.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 26e84bf462a67bf41bcc28be718464861ce482d8
|
4
|
+
data.tar.gz: c38874bc575bfe27d3481ea5e6b61d8f9da28ca1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 28ade5c8d559625c6d584202ecdd9ce5ca0bc55d2e49fe3bfe3480629df45e766311986cf8d0a1ba80d2f1b3826094c18014c8e2dd3e754702067391d726846f
|
7
|
+
data.tar.gz: fc164fb6434984bd6c6f05964a2755b08c71c303480542dea0da5149dc0c3e60d79eb61c74afaafb8aa44a591baba8a728bb4420f34ca91055918b7ee38c064a
|
data/.travis.yml
CHANGED
data/lib/solr_wrapper.rb
CHANGED
@@ -1,17 +1,23 @@
|
|
1
|
+
require 'ruby-progressbar'
|
2
|
+
|
1
3
|
module SolrWrapper
|
2
4
|
class Downloader
|
3
5
|
def self.fetch_with_progressbar(url, output)
|
4
|
-
pbar =
|
5
|
-
open(url, content_length_proc:
|
6
|
-
if t && 0 < t
|
7
|
-
pbar.total = t
|
8
|
-
end
|
9
|
-
end,
|
10
|
-
progress_proc: lambda do|s|
|
11
|
-
pbar.progress = s
|
12
|
-
end) do |io|
|
6
|
+
pbar = SafeProgressBar.new(title: File.basename(url), total: nil, format: '%t: |%B| %p%% (%e )')
|
7
|
+
open(url, content_length_proc: ->(bytes) { pbar.total = bytes }, progress_proc: ->(bytes) { pbar.progress = bytes }) do |io|
|
13
8
|
IO.copy_stream(io, output)
|
14
9
|
end
|
15
10
|
end
|
11
|
+
|
12
|
+
class SafeProgressBar < ProgressBar::Base
|
13
|
+
def progress=(new_progress)
|
14
|
+
self.total = new_progress if total <= new_progress
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
def total=(new_total)
|
19
|
+
super if new_total && new_total > 0
|
20
|
+
end
|
21
|
+
end
|
16
22
|
end
|
17
23
|
end
|
data/lib/solr_wrapper/version.rb
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: 0.
|
4
|
+
version: 0.8.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-
|
11
|
+
date: 2016-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyzip
|
@@ -171,7 +171,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
171
171
|
version: '0'
|
172
172
|
requirements: []
|
173
173
|
rubyforge_project:
|
174
|
-
rubygems_version: 2.5.1
|
174
|
+
rubygems_version: 2.4.5.1
|
175
175
|
signing_key:
|
176
176
|
specification_version: 4
|
177
177
|
summary: Solr 5 service wrapper
|
@@ -189,4 +189,3 @@ test_files:
|
|
189
189
|
- spec/lib/solr_wrapper/instance_spec.rb
|
190
190
|
- spec/lib/solr_wrapper_spec.rb
|
191
191
|
- spec/spec_helper.rb
|
192
|
-
has_rdoc:
|