samlown-couchrest 0.37.1 → 0.37.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ end
15
15
  begin
16
16
  require 'jeweler'
17
17
  Jeweler::Tasks.new do |gemspec|
18
- gemspec.name = "couchrest"
18
+ gemspec.name = "samlown-couchrest"
19
19
  gemspec.summary = "Lean and RESTful interface to CouchDB."
20
20
  gemspec.description = "CouchRest provides a simple interface on top of CouchDB's RESTful HTTP API, as well as including some utility scripts for managing views and attachments."
21
21
  gemspec.email = "jchris@apache.org"
data/couchrest.gemspec CHANGED
@@ -4,12 +4,12 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{samlown-couchrest}
8
- s.version = "0.37.1"
7
+ s.name = %q{couchrest}
8
+ s.version = "0.37"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["J. Chris Anderson", "Matt Aimonetti", "Marcos Tapajos", "Will Leinweber"]
12
- s.date = %q{2010-03-30}
12
+ s.date = %q{2010-04-05}
13
13
  s.description = %q{CouchRest provides a simple interface on top of CouchDB's RESTful HTTP API, as well as including some utility scripts for managing views and attachments.}
14
14
  s.email = %q{jchris@apache.org}
15
15
  s.extra_rdoc_files = [
@@ -131,37 +131,37 @@ Gem::Specification.new do |s|
131
131
  s.rubygems_version = %q{1.3.6}
132
132
  s.summary = %q{Lean and RESTful interface to CouchDB.}
133
133
  s.test_files = [
134
- "spec/couchrest/core/couchrest_spec.rb",
135
- "spec/couchrest/core/database_spec.rb",
136
- "spec/couchrest/core/design_spec.rb",
137
- "spec/couchrest/core/document_spec.rb",
138
- "spec/couchrest/core/server_spec.rb",
139
- "spec/couchrest/helpers/pager_spec.rb",
140
- "spec/couchrest/helpers/streamer_spec.rb",
141
- "spec/couchrest/more/attribute_protection_spec.rb",
134
+ "spec/couchrest/more/extended_doc_attachment_spec.rb",
142
135
  "spec/couchrest/more/casted_extended_doc_spec.rb",
143
- "spec/couchrest/more/casted_model_spec.rb",
144
- "spec/couchrest/more/extended_doc_attachment_spec.rb",
145
136
  "spec/couchrest/more/extended_doc_inherited_spec.rb",
146
- "spec/couchrest/more/extended_doc_spec.rb",
147
- "spec/couchrest/more/extended_doc_subclass_spec.rb",
137
+ "spec/couchrest/more/casted_model_spec.rb",
148
138
  "spec/couchrest/more/extended_doc_view_spec.rb",
139
+ "spec/couchrest/more/extended_doc_spec.rb",
149
140
  "spec/couchrest/more/property_spec.rb",
150
- "spec/fixtures/more/article.rb",
151
- "spec/fixtures/more/card.rb",
141
+ "spec/couchrest/more/attribute_protection_spec.rb",
142
+ "spec/couchrest/more/extended_doc_subclass_spec.rb",
143
+ "spec/couchrest/helpers/streamer_spec.rb",
144
+ "spec/couchrest/helpers/pager_spec.rb",
145
+ "spec/couchrest/core/design_spec.rb",
146
+ "spec/couchrest/core/server_spec.rb",
147
+ "spec/couchrest/core/couchrest_spec.rb",
148
+ "spec/couchrest/core/database_spec.rb",
149
+ "spec/couchrest/core/document_spec.rb",
150
+ "spec/fixtures/more/person.rb",
152
151
  "spec/fixtures/more/cat.rb",
152
+ "spec/fixtures/more/card.rb",
153
153
  "spec/fixtures/more/course.rb",
154
- "spec/fixtures/more/event.rb",
155
- "spec/fixtures/more/invoice.rb",
156
- "spec/fixtures/more/person.rb",
157
- "spec/fixtures/more/question.rb",
158
154
  "spec/fixtures/more/service.rb",
155
+ "spec/fixtures/more/article.rb",
156
+ "spec/fixtures/more/invoice.rb",
159
157
  "spec/fixtures/more/user.rb",
158
+ "spec/fixtures/more/event.rb",
159
+ "spec/fixtures/more/question.rb",
160
160
  "spec/spec_helper.rb",
161
- "examples/model/example.rb",
161
+ "examples/word_count/word_count_views.rb",
162
162
  "examples/word_count/word_count.rb",
163
163
  "examples/word_count/word_count_query.rb",
164
- "examples/word_count/word_count_views.rb"
164
+ "examples/model/example.rb"
165
165
  ]
166
166
 
167
167
  if s.respond_to? :specification_version then
@@ -20,7 +20,7 @@ module CouchRest
20
20
  class_eval <<-END, __FILE__, __LINE__ + 1
21
21
  def self.find_all_#{collection_name}(options = {})
22
22
  view_options = #{view_options.inspect} || {}
23
- CollectionProxy.new(database, "#{design_doc}", "#{view_name}", view_options.merge(options), Kernel.const_get('#{self}'))
23
+ CollectionProxy.new(options[:database] || database, "#{design_doc}", "#{view_name}", view_options.merge(options), Kernel.const_get('#{self}'))
24
24
  end
25
25
  END
26
26
  end
@@ -63,12 +63,12 @@ module CouchRest
63
63
 
64
64
  def create_collection_proxy(options)
65
65
  design_doc, view_name, view_options = parse_view_options(options)
66
- CollectionProxy.new(database, design_doc, view_name, view_options, self)
66
+ CollectionProxy.new(options[:database] || database, design_doc, view_name, view_options, self)
67
67
  end
68
68
 
69
69
  def create_search_collection_proxy(options)
70
70
  design_doc, search_name, search_options = parse_search_options(options)
71
- CollectionProxy.new(@database, design_doc, search_name, search_options, self, :search)
71
+ CollectionProxy.new(options[:database] || database, design_doc, search_name, search_options, self, :search)
72
72
  end
73
73
 
74
74
  def parse_view_options(options)
data/lib/couchrest.rb CHANGED
@@ -28,7 +28,7 @@ require 'couchrest/monkeypatches'
28
28
 
29
29
  # = CouchDB, close to the metal
30
30
  module CouchRest
31
- VERSION = '0.37' unless self.const_defined?("VERSION")
31
+ VERSION = '0.37.2' unless self.const_defined?("VERSION")
32
32
 
33
33
  autoload :Server, 'couchrest/core/server'
34
34
  autoload :Database, 'couchrest/core/database'
@@ -83,7 +83,7 @@ describe "ExtendedDocument" do
83
83
  self.conditional_two = true
84
84
  end
85
85
  end
86
-
86
+
87
87
  class WithTemplateAndUniqueID < CouchRest::ExtendedDocument
88
88
  use_database TEST_SERVER.default_database
89
89
  unique_id do |model|
@@ -641,6 +641,7 @@ describe "ExtendedDocument" do
641
641
  @doc.run_after_validate.should be_true
642
642
  end
643
643
  end
644
+
644
645
  describe "save" do
645
646
  it "should run the after filter after saving" do
646
647
  @doc.run_after_save.should be_nil
@@ -451,6 +451,12 @@ describe "ExtendedDocument views" do
451
451
  articles.paginate(:page => 4, :per_page => 3).size.should == 3
452
452
  articles.paginate(:page => 5, :per_page => 3).size.should == 1
453
453
  end
454
+ it "should pass database parameter to pager" do
455
+ proxy = mock(:proxy)
456
+ proxy.stub!(:paginate)
457
+ ::CouchRest::Mixins::Collection::CollectionProxy.should_receive(:new).with('database', anything(), anything(), anything(), anything()).and_return(proxy)
458
+ Article.paginate(:design_doc => 'Article', :view_name => 'by_date', :database => 'database')
459
+ end
454
460
  end
455
461
 
456
462
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 37
8
- - 1
9
- version: 0.37.1
8
+ - 2
9
+ version: 0.37.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - J. Chris Anderson
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2010-03-30 00:00:00 +00:00
20
+ date: 2010-04-05 00:00:00 +00:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -194,34 +194,34 @@ signing_key:
194
194
  specification_version: 3
195
195
  summary: Lean and RESTful interface to CouchDB.
196
196
  test_files:
197
- - spec/couchrest/core/couchrest_spec.rb
198
- - spec/couchrest/core/database_spec.rb
199
- - spec/couchrest/core/design_spec.rb
200
- - spec/couchrest/core/document_spec.rb
201
- - spec/couchrest/core/server_spec.rb
202
- - spec/couchrest/helpers/pager_spec.rb
203
- - spec/couchrest/helpers/streamer_spec.rb
204
- - spec/couchrest/more/attribute_protection_spec.rb
205
- - spec/couchrest/more/casted_extended_doc_spec.rb
206
- - spec/couchrest/more/casted_model_spec.rb
207
197
  - spec/couchrest/more/extended_doc_attachment_spec.rb
198
+ - spec/couchrest/more/casted_extended_doc_spec.rb
208
199
  - spec/couchrest/more/extended_doc_inherited_spec.rb
209
- - spec/couchrest/more/extended_doc_spec.rb
210
- - spec/couchrest/more/extended_doc_subclass_spec.rb
200
+ - spec/couchrest/more/casted_model_spec.rb
211
201
  - spec/couchrest/more/extended_doc_view_spec.rb
202
+ - spec/couchrest/more/extended_doc_spec.rb
212
203
  - spec/couchrest/more/property_spec.rb
213
- - spec/fixtures/more/article.rb
214
- - spec/fixtures/more/card.rb
204
+ - spec/couchrest/more/attribute_protection_spec.rb
205
+ - spec/couchrest/more/extended_doc_subclass_spec.rb
206
+ - spec/couchrest/helpers/streamer_spec.rb
207
+ - spec/couchrest/helpers/pager_spec.rb
208
+ - spec/couchrest/core/design_spec.rb
209
+ - spec/couchrest/core/server_spec.rb
210
+ - spec/couchrest/core/couchrest_spec.rb
211
+ - spec/couchrest/core/database_spec.rb
212
+ - spec/couchrest/core/document_spec.rb
213
+ - spec/fixtures/more/person.rb
215
214
  - spec/fixtures/more/cat.rb
215
+ - spec/fixtures/more/card.rb
216
216
  - spec/fixtures/more/course.rb
217
- - spec/fixtures/more/event.rb
218
- - spec/fixtures/more/invoice.rb
219
- - spec/fixtures/more/person.rb
220
- - spec/fixtures/more/question.rb
221
217
  - spec/fixtures/more/service.rb
218
+ - spec/fixtures/more/article.rb
219
+ - spec/fixtures/more/invoice.rb
222
220
  - spec/fixtures/more/user.rb
221
+ - spec/fixtures/more/event.rb
222
+ - spec/fixtures/more/question.rb
223
223
  - spec/spec_helper.rb
224
- - examples/model/example.rb
224
+ - examples/word_count/word_count_views.rb
225
225
  - examples/word_count/word_count.rb
226
226
  - examples/word_count/word_count_query.rb
227
- - examples/word_count/word_count_views.rb
227
+ - examples/model/example.rb