rsolr-ext 1.0.1 → 1.0.3

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.
data/Rakefile CHANGED
@@ -11,10 +11,10 @@ begin
11
11
  gem.homepage = "http://github.com/mwmitchell/rsolr-ext"
12
12
  gem.authors = ["Matt Mitchell", "James Davidson", "Chris Beer", "Jason Ronallo", "Eric Lindvall", "Andreas Kemkes"]
13
13
  gem.add_development_dependency "rspec", ">= 1.2.9"
14
- gem.add_dependency "rsolr", ">= 1.0.1"
14
+ gem.add_dependency "rsolr", ">= 1.0.2"
15
15
 
16
16
  gem.files = FileList['lib/**/*.rb', 'LICENSE', 'README.rdoc', 'VERSION']
17
- gem.test_files = ['spec/*', 'Rakefile']
17
+ gem.test_files = Dir['spec/*'] + FileList['Rakefile']
18
18
 
19
19
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
20
20
  end
@@ -35,14 +35,13 @@ Spec::Rake::SpecTask.new(:rcov) do |spec|
35
35
  spec.rcov = true
36
36
  end
37
37
 
38
- task :spec => :check_dependencies
38
+ #task :spec => :check_dependencies
39
39
 
40
40
  task :default => :spec
41
41
 
42
- require 'rake/rdoctask'
43
- Rake::RDocTask.new do |rdoc|
42
+ require "rdoc/task"
43
+ RDoc::Task.new do |rdoc|
44
44
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
45
-
46
45
  rdoc.rdoc_dir = 'rdoc'
47
46
  rdoc.title = "rsolr-ext #{version}"
48
47
  rdoc.rdoc_files.include('README*')
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.3
@@ -29,7 +29,6 @@ module RSolr::Ext
29
29
 
30
30
  # modify the RSolr::Client (provides #find and #luke methods)
31
31
  RSolr::Client.class_eval do
32
- warn "DEPRECATION WARNING: Future versions of RSolr::Ext will require initialization via RSolr::Ext.connect."
33
32
  include RSolr::Ext::Client
34
33
  end
35
34
 
@@ -15,7 +15,12 @@ module RSolr::Ext::Client
15
15
  path, params, opts = rsolr_request_arguments_for(*args)
16
16
  path ||= "select"
17
17
  # send path, map params and send the rest of the args along
18
- response = self.send_and_receive path, opts.merge({ :params => RSolr::Ext::Request.map(params) })
18
+ if params[:page] || params[:per_page]
19
+ response = self.paginate params[:page], params[:per_page], path, opts.merge({ :params => RSolr::Ext::Request.map(params) })
20
+ else
21
+ response = self.send_and_receive path, opts.merge({ :params => RSolr::Ext::Request.map(params) })
22
+ end
23
+
19
24
  RSolr::Ext::Response::Base.new(response, path, params)
20
25
  end
21
26
 
@@ -1,19 +1,5 @@
1
1
  module RSolr::Ext::Response::Docs
2
2
 
3
- # NOTE: This might move/change in the next major release of RSolr::Ext
4
- module WillPaginateExt
5
- class MissingLibError < RuntimeError
6
- def to_s; "WillPaginate is required" end
7
- end
8
- def will_paginate
9
- WillPaginate::Collection.create(self.current_page, self.per_page, self.total) do |pager|
10
- pager.replace(self)
11
- end
12
- rescue NameError
13
- raise MissingLibError.new
14
- end
15
- end
16
-
17
3
  def self.extended(base)
18
4
  d = base['response']['docs']
19
5
  # TODO: could we do this lazily (Enumerable etc.)
@@ -22,7 +8,6 @@ module RSolr::Ext::Response::Docs
22
8
  d.per_page = [base.rows, 1].max
23
9
  d.start = base.start
24
10
  d.total = base.total
25
- d.extend WillPaginateExt
26
11
  end
27
12
 
28
13
  module Pageable
@@ -67,7 +52,6 @@ module RSolr::Ext::Response::Docs
67
52
 
68
53
  def docs
69
54
  @docs ||= begin
70
- warn "DEPRECATION WARNING: The custom pagination codebase in RSolr::Ext will no longer be supported. Use response.docs.will_paginate instead."
71
55
  response['docs']
72
56
  end
73
57
  end
@@ -12,8 +12,8 @@ describe RSolr::Ext do
12
12
 
13
13
  it 'should produce results from the #find method' do
14
14
  c = client
15
- c.should_receive(:send_and_receive).
16
- with('select', {:params => {:rows=>10, :start=>20, :q=>"*:*"}}).
15
+ c.should_receive(:paginate).
16
+ with(3, 10, 'select', {:params => {:rows=>10, :start=>20, :q=>"*:*"}}).
17
17
  and_return({'response'=>{'docs' => []}, 'responseHeader' => {}})
18
18
  response = c.find :page=>3, :per_page=>10, :q=>'*:*'#, :page=>1, :per_page=>10
19
19
  response.should be_a(Mash)
@@ -218,6 +218,7 @@ describe RSolr::Ext do
218
218
  r.ok?.should == true
219
219
  r.docs.size.should == 11
220
220
  r.params[:echoParams].should == 'EXPLICIT'
221
+
221
222
  r.docs.previous_page.should == 1
222
223
  r.docs.next_page.should == 2
223
224
  r.docs.has_previous?.should == false
@@ -328,33 +329,6 @@ describe RSolr::Ext do
328
329
  r = RSolr::Ext::Response::Base.new(raw_response, '/catalog', {})
329
330
  r.spelling.collation.should == 'dell ultrasharp'
330
331
  end
331
-
332
- ###############################
333
-
334
- context "docs.will_paginate" do
335
-
336
- it 'will raise a RSolr::Ext::Response::Docs::WillPaginateExt::MissingLibError if WillPaginate is not defined' do
337
- r = create_response
338
- r.docs.should respond_to(:will_paginate)
339
- lambda{
340
- r.docs.will_paginate
341
- }.should(raise_error(
342
- RSolr::Ext::Response::Docs::WillPaginateExt::MissingLibError,
343
- "WillPaginate is required"))
344
- end
345
-
346
- it 'will work, and return a WillPaginate::Collectionified doc array' do
347
- # this is one funky part about dynamic dependencies...
348
- require "will_paginate"
349
- r = create_response
350
- original_docs = r.docs
351
- r.docs.should_not be_a(WillPaginate::Collection)
352
- r.docs.should respond_to(:will_paginate)
353
- r.docs.will_paginate.should be_a(WillPaginate::Collection)
354
- r.docs.should be(original_docs)
355
- end
356
-
357
- end
358
332
 
359
333
  end
360
334
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsolr-ext
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 1
10
- version: 1.0.1
9
+ - 3
10
+ version: 1.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Matt Mitchell
@@ -20,7 +20,7 @@ autorequire:
20
20
  bindir: bin
21
21
  cert_chain: []
22
22
 
23
- date: 2011-05-26 00:00:00 -04:00
23
+ date: 2011-06-08 00:00:00 -04:00
24
24
  default_executable:
25
25
  dependencies:
26
26
  - !ruby/object:Gem::Dependency
@@ -47,12 +47,12 @@ dependencies:
47
47
  requirements:
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
- hash: 21
50
+ hash: 19
51
51
  segments:
52
52
  - 1
53
53
  - 0
54
- - 1
55
- version: 1.0.1
54
+ - 2
55
+ version: 1.0.2
56
56
  type: :runtime
57
57
  version_requirements: *id002
58
58
  description: A query/response extension lib for RSolr
@@ -78,10 +78,10 @@ files:
78
78
  - lib/rsolr-ext/response/docs.rb
79
79
  - lib/rsolr-ext/response/facets.rb
80
80
  - lib/rsolr-ext/response/spelling.rb
81
- - Rakefile
82
81
  - spec/rsolr-ext_spec.rb
83
82
  - spec/spec.opts
84
83
  - spec/spec_helper.rb
84
+ - Rakefile
85
85
  has_rdoc: true
86
86
  homepage: http://github.com/mwmitchell/rsolr-ext
87
87
  licenses: []
@@ -112,12 +112,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  requirements: []
113
113
 
114
114
  rubyforge_project:
115
- rubygems_version: 1.5.0
115
+ rubygems_version: 1.6.2
116
116
  signing_key:
117
117
  specification_version: 3
118
118
  summary: A query/response extension lib for RSolr
119
119
  test_files:
120
- - Rakefile
121
120
  - spec/rsolr-ext_spec.rb
122
121
  - spec/spec.opts
123
122
  - spec/spec_helper.rb
123
+ - Rakefile