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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2980ce0da6b13f768917b7a81ebeb45dfd2a4ff6
4
- data.tar.gz: b8f4d793718df779050a5c571016b326cd8e3de3
3
+ metadata.gz: 236a1eced6b831ca9b182fb6a69031495567acd7
4
+ data.tar.gz: e053e51b06aad6e8420675b1b7718c259fa98c64
5
5
  SHA512:
6
- metadata.gz: 635757846c0b44d01d92993837555a38661c97638b745cc83d55be0fd59f098c09ad05fa7e316afcfe0dd8c49199d43dc22ad435994392bb5f67d84a87cf251b
7
- data.tar.gz: 84d932af417c6823d9666361ab2044dad3112555121d5b7df4bca6ec72e32408265167f67fbe838e76ac8f42039e19c483ae40e5e6b4c9b39fa2c4aab4f87554
6
+ metadata.gz: 74b2782c628c9fc4903dec66dd405a66cf01212ee126ac768325745f6ee6c5d22b7772facb0c28f7f82d2cfeb24634c3faccdec24d27b76c84d324f1a47de5ed
7
+ data.tar.gz: b81687cee34cdc5feeffbf3fea6868c08aff80cfd664e9e88b4cf252ae18cb1f435406373b7ae322c57840a0eb3c7d6c637b7211afb5fefe794f8d3cc6a95c86
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ sudo: false
3
+ rvm:
4
+ - 2.2.0
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
@@ -1,2 +1,8 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
+
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: ['spec']
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.new("solr", nil)
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.set s if 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.new("md5", nil)
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.set s if pbar
151
+ pbar.progress = s
154
152
  }) do |io|
155
153
  IO.copy_stream(io, md5sum_path)
156
154
  end
@@ -1,3 +1,3 @@
1
1
  module SolrWrapper
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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 verbose: true}
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(1) do
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
@@ -1,5 +1,9 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
1
4
  require 'solr_wrapper'
2
5
  require 'simple_solr_client'
6
+
3
7
  require 'rspec'
4
8
 
5
9
  FIXTURES_DIR = File.expand_path("fixtures", File.dirname(__FILE__))
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.1
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