samlown-couchrest 0.35 → 0.37.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +3 -3
- data/Rakefile +1 -1
- data/couchrest.gemspec +183 -0
- data/history.txt +13 -2
- data/lib/couchrest.rb +1 -1
- data/lib/couchrest/more/casted_array.rb +25 -0
- data/spec/couchrest/more/extended_doc_spec.rb +11 -1
- metadata +26 -22
data/README.md
CHANGED
@@ -33,11 +33,11 @@ Check the wiki for documentation and examples [http://wiki.github.com/couchrest/
|
|
33
33
|
|
34
34
|
## Contact
|
35
35
|
|
36
|
-
Please post bugs, suggestions and patches to the bug tracker at
|
36
|
+
Please post bugs, suggestions and patches to the bug tracker at [http://github.com/couchrest/couchrest/issues](http://github.com/couchrest/couchrest/issues).
|
37
37
|
|
38
|
-
Follow us on Twitter: http://twitter.com/couchrest
|
38
|
+
Follow us on Twitter: [http://twitter.com/couchrest](http://twitter.com/couchrest)
|
39
39
|
|
40
|
-
Also, check http://twitter.com/#search?q=%23couchrest
|
40
|
+
Also, check [http://twitter.com/#search?q=%23couchrest](http://twitter.com/#search?q=%23couchrest)
|
41
41
|
|
42
42
|
## Ruby on Rails
|
43
43
|
|
data/Rakefile
CHANGED
@@ -22,7 +22,7 @@ begin
|
|
22
22
|
gemspec.homepage = "http://github.com/couchrest/couchrest"
|
23
23
|
gemspec.authors = ["J. Chris Anderson", "Matt Aimonetti", "Marcos Tapajos", "Will Leinweber"]
|
24
24
|
gemspec.extra_rdoc_files = %w( README.md LICENSE THANKS.md )
|
25
|
-
gemspec.files = %w( LICENSE README.md Rakefile THANKS.md history.txt) + Dir["{examples,lib,spec,utils}/**/*"] - Dir["spec/tmp"]
|
25
|
+
gemspec.files = %w( LICENSE README.md Rakefile THANKS.md history.txt couchrest.gemspec) + Dir["{examples,lib,spec,utils}/**/*"] - Dir["spec/tmp"]
|
26
26
|
gemspec.has_rdoc = true
|
27
27
|
gemspec.add_dependency("rest-client", ">= 0.5")
|
28
28
|
gemspec.add_dependency("mime-types", ">= 1.15")
|
data/couchrest.gemspec
ADDED
@@ -0,0 +1,183 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{samlown-couchrest}
|
8
|
+
s.version = "0.37.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["J. Chris Anderson", "Matt Aimonetti", "Marcos Tapajos", "Will Leinweber"]
|
12
|
+
s.date = %q{2010-03-30}
|
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
|
+
s.email = %q{jchris@apache.org}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE",
|
17
|
+
"README.md",
|
18
|
+
"THANKS.md"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
"LICENSE",
|
22
|
+
"README.md",
|
23
|
+
"Rakefile",
|
24
|
+
"THANKS.md",
|
25
|
+
"couchrest.gemspec",
|
26
|
+
"examples/model/example.rb",
|
27
|
+
"examples/word_count/markov",
|
28
|
+
"examples/word_count/views/books/chunked-map.js",
|
29
|
+
"examples/word_count/views/books/united-map.js",
|
30
|
+
"examples/word_count/views/markov/chain-map.js",
|
31
|
+
"examples/word_count/views/markov/chain-reduce.js",
|
32
|
+
"examples/word_count/views/word_count/count-map.js",
|
33
|
+
"examples/word_count/views/word_count/count-reduce.js",
|
34
|
+
"examples/word_count/word_count.rb",
|
35
|
+
"examples/word_count/word_count_query.rb",
|
36
|
+
"examples/word_count/word_count_views.rb",
|
37
|
+
"history.txt",
|
38
|
+
"lib/couchrest.rb",
|
39
|
+
"lib/couchrest/commands/generate.rb",
|
40
|
+
"lib/couchrest/commands/push.rb",
|
41
|
+
"lib/couchrest/core/adapters/restclient.rb",
|
42
|
+
"lib/couchrest/core/database.rb",
|
43
|
+
"lib/couchrest/core/design.rb",
|
44
|
+
"lib/couchrest/core/document.rb",
|
45
|
+
"lib/couchrest/core/http_abstraction.rb",
|
46
|
+
"lib/couchrest/core/response.rb",
|
47
|
+
"lib/couchrest/core/rest_api.rb",
|
48
|
+
"lib/couchrest/core/server.rb",
|
49
|
+
"lib/couchrest/core/view.rb",
|
50
|
+
"lib/couchrest/helper/pager.rb",
|
51
|
+
"lib/couchrest/helper/streamer.rb",
|
52
|
+
"lib/couchrest/helper/upgrade.rb",
|
53
|
+
"lib/couchrest/middlewares/logger.rb",
|
54
|
+
"lib/couchrest/mixins.rb",
|
55
|
+
"lib/couchrest/mixins/attachments.rb",
|
56
|
+
"lib/couchrest/mixins/attribute_protection.rb",
|
57
|
+
"lib/couchrest/mixins/callbacks.rb",
|
58
|
+
"lib/couchrest/mixins/class_proxy.rb",
|
59
|
+
"lib/couchrest/mixins/collection.rb",
|
60
|
+
"lib/couchrest/mixins/design_doc.rb",
|
61
|
+
"lib/couchrest/mixins/document_queries.rb",
|
62
|
+
"lib/couchrest/mixins/extended_attachments.rb",
|
63
|
+
"lib/couchrest/mixins/extended_document_mixins.rb",
|
64
|
+
"lib/couchrest/mixins/properties.rb",
|
65
|
+
"lib/couchrest/mixins/validation.rb",
|
66
|
+
"lib/couchrest/mixins/views.rb",
|
67
|
+
"lib/couchrest/monkeypatches.rb",
|
68
|
+
"lib/couchrest/more/casted_array.rb",
|
69
|
+
"lib/couchrest/more/casted_model.rb",
|
70
|
+
"lib/couchrest/more/extended_document.rb",
|
71
|
+
"lib/couchrest/more/property.rb",
|
72
|
+
"lib/couchrest/more/typecast.rb",
|
73
|
+
"lib/couchrest/support/blank.rb",
|
74
|
+
"lib/couchrest/support/class.rb",
|
75
|
+
"lib/couchrest/support/rails.rb",
|
76
|
+
"lib/couchrest/validation/auto_validate.rb",
|
77
|
+
"lib/couchrest/validation/contextual_validators.rb",
|
78
|
+
"lib/couchrest/validation/validation_errors.rb",
|
79
|
+
"lib/couchrest/validation/validators/absent_field_validator.rb",
|
80
|
+
"lib/couchrest/validation/validators/confirmation_validator.rb",
|
81
|
+
"lib/couchrest/validation/validators/format_validator.rb",
|
82
|
+
"lib/couchrest/validation/validators/formats/email.rb",
|
83
|
+
"lib/couchrest/validation/validators/formats/url.rb",
|
84
|
+
"lib/couchrest/validation/validators/generic_validator.rb",
|
85
|
+
"lib/couchrest/validation/validators/length_validator.rb",
|
86
|
+
"lib/couchrest/validation/validators/method_validator.rb",
|
87
|
+
"lib/couchrest/validation/validators/numeric_validator.rb",
|
88
|
+
"lib/couchrest/validation/validators/required_field_validator.rb",
|
89
|
+
"spec/couchrest/core/couchrest_spec.rb",
|
90
|
+
"spec/couchrest/core/database_spec.rb",
|
91
|
+
"spec/couchrest/core/design_spec.rb",
|
92
|
+
"spec/couchrest/core/document_spec.rb",
|
93
|
+
"spec/couchrest/core/server_spec.rb",
|
94
|
+
"spec/couchrest/helpers/pager_spec.rb",
|
95
|
+
"spec/couchrest/helpers/streamer_spec.rb",
|
96
|
+
"spec/couchrest/more/attribute_protection_spec.rb",
|
97
|
+
"spec/couchrest/more/casted_extended_doc_spec.rb",
|
98
|
+
"spec/couchrest/more/casted_model_spec.rb",
|
99
|
+
"spec/couchrest/more/extended_doc_attachment_spec.rb",
|
100
|
+
"spec/couchrest/more/extended_doc_inherited_spec.rb",
|
101
|
+
"spec/couchrest/more/extended_doc_spec.rb",
|
102
|
+
"spec/couchrest/more/extended_doc_subclass_spec.rb",
|
103
|
+
"spec/couchrest/more/extended_doc_view_spec.rb",
|
104
|
+
"spec/couchrest/more/property_spec.rb",
|
105
|
+
"spec/fixtures/attachments/README",
|
106
|
+
"spec/fixtures/attachments/couchdb.png",
|
107
|
+
"spec/fixtures/attachments/test.html",
|
108
|
+
"spec/fixtures/more/article.rb",
|
109
|
+
"spec/fixtures/more/card.rb",
|
110
|
+
"spec/fixtures/more/cat.rb",
|
111
|
+
"spec/fixtures/more/course.rb",
|
112
|
+
"spec/fixtures/more/event.rb",
|
113
|
+
"spec/fixtures/more/invoice.rb",
|
114
|
+
"spec/fixtures/more/person.rb",
|
115
|
+
"spec/fixtures/more/question.rb",
|
116
|
+
"spec/fixtures/more/service.rb",
|
117
|
+
"spec/fixtures/more/user.rb",
|
118
|
+
"spec/fixtures/views/lib.js",
|
119
|
+
"spec/fixtures/views/test_view/lib.js",
|
120
|
+
"spec/fixtures/views/test_view/only-map.js",
|
121
|
+
"spec/fixtures/views/test_view/test-map.js",
|
122
|
+
"spec/fixtures/views/test_view/test-reduce.js",
|
123
|
+
"spec/spec.opts",
|
124
|
+
"spec/spec_helper.rb",
|
125
|
+
"utils/remap.rb",
|
126
|
+
"utils/subset.rb"
|
127
|
+
]
|
128
|
+
s.homepage = %q{http://github.com/couchrest/couchrest}
|
129
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
130
|
+
s.require_paths = ["lib"]
|
131
|
+
s.rubygems_version = %q{1.3.6}
|
132
|
+
s.summary = %q{Lean and RESTful interface to CouchDB.}
|
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",
|
142
|
+
"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
|
+
"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",
|
148
|
+
"spec/couchrest/more/extended_doc_view_spec.rb",
|
149
|
+
"spec/couchrest/more/property_spec.rb",
|
150
|
+
"spec/fixtures/more/article.rb",
|
151
|
+
"spec/fixtures/more/card.rb",
|
152
|
+
"spec/fixtures/more/cat.rb",
|
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
|
+
"spec/fixtures/more/service.rb",
|
159
|
+
"spec/fixtures/more/user.rb",
|
160
|
+
"spec/spec_helper.rb",
|
161
|
+
"examples/model/example.rb",
|
162
|
+
"examples/word_count/word_count.rb",
|
163
|
+
"examples/word_count/word_count_query.rb",
|
164
|
+
"examples/word_count/word_count_views.rb"
|
165
|
+
]
|
166
|
+
|
167
|
+
if s.respond_to? :specification_version then
|
168
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
169
|
+
s.specification_version = 3
|
170
|
+
|
171
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
172
|
+
s.add_runtime_dependency(%q<rest-client>, [">= 0.5"])
|
173
|
+
s.add_runtime_dependency(%q<mime-types>, [">= 1.15"])
|
174
|
+
else
|
175
|
+
s.add_dependency(%q<rest-client>, [">= 0.5"])
|
176
|
+
s.add_dependency(%q<mime-types>, [">= 1.15"])
|
177
|
+
end
|
178
|
+
else
|
179
|
+
s.add_dependency(%q<rest-client>, [">= 0.5"])
|
180
|
+
s.add_dependency(%q<mime-types>, [">= 1.15"])
|
181
|
+
end
|
182
|
+
end
|
183
|
+
|
data/history.txt
CHANGED
@@ -1,10 +1,21 @@
|
|
1
1
|
== Next Version
|
2
2
|
|
3
|
+
* Major enhancements
|
4
|
+
|
5
|
+
* Minor enhancements
|
6
|
+
|
7
|
+
== 0.37
|
8
|
+
|
9
|
+
* Minor enhancements
|
10
|
+
* Added gemspec (needed for Bundler install) (Tapajós)
|
11
|
+
|
12
|
+
== 0.36
|
13
|
+
|
3
14
|
* Major enhancements
|
4
15
|
* Adds support for continuous replication (sauy7)
|
5
16
|
* Automatic Type Casting (Alexander Uvarov, Sam Lown, Tim Heighes, Will Leinweber)
|
6
|
-
* Added a search method to CouchRest:Database to search the documents in a
|
7
|
-
|
17
|
+
* Added a search method to CouchRest:Database to search the documents in a given database. (Dave Farkas, Arnaud Berthomier, John Wood)
|
18
|
+
|
8
19
|
* Minor enhancements
|
9
20
|
* Provide a description of the timeout error (John Wood)
|
10
21
|
|
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.
|
31
|
+
VERSION = '0.37' unless self.const_defined?("VERSION")
|
32
32
|
|
33
33
|
autoload :Server, 'couchrest/core/server'
|
34
34
|
autoload :Database, 'couchrest/core/database'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
#
|
2
|
+
# Wrapper around Array so that the casted_by attribute is set in all
|
3
|
+
# elements of the array.
|
4
|
+
#
|
5
|
+
|
6
|
+
module CouchRest
|
7
|
+
class CastedArray < Array
|
8
|
+
attr_accessor :casted_by
|
9
|
+
|
10
|
+
def << obj
|
11
|
+
obj.casted_by = self.casted_by if obj.respond_to?(:casted_by)
|
12
|
+
super(obj)
|
13
|
+
end
|
14
|
+
|
15
|
+
def push(obj)
|
16
|
+
obj.casted_by = self.casted_by if obj.respond_to?(:casted_by)
|
17
|
+
super(obj)
|
18
|
+
end
|
19
|
+
|
20
|
+
def []= index, obj
|
21
|
+
obj.casted_by = self.casted_by if obj.respond_to?(:casted_by)
|
22
|
+
super(index, obj)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -3,6 +3,7 @@
|
|
3
3
|
require File.expand_path("../../../spec_helper", __FILE__)
|
4
4
|
require File.join(FIXTURE_PATH, 'more', 'article')
|
5
5
|
require File.join(FIXTURE_PATH, 'more', 'course')
|
6
|
+
require File.join(FIXTURE_PATH, 'more', 'card')
|
6
7
|
require File.join(FIXTURE_PATH, 'more', 'cat')
|
7
8
|
|
8
9
|
describe "ExtendedDocument" do
|
@@ -426,7 +427,16 @@ describe "ExtendedDocument" do
|
|
426
427
|
obj.created_at.should be_an_instance_of(Time)
|
427
428
|
obj.updated_at.should be_an_instance_of(Time)
|
428
429
|
obj.created_at.to_s.should == @obj.updated_at.to_s
|
429
|
-
end
|
430
|
+
end
|
431
|
+
|
432
|
+
it "should not change created_at on update" do
|
433
|
+
2.times do
|
434
|
+
lambda do
|
435
|
+
@art.save
|
436
|
+
end.should_not change(@art, :created_at)
|
437
|
+
end
|
438
|
+
end
|
439
|
+
|
430
440
|
it "should set the time on create" do
|
431
441
|
(Time.now - @art.created_at).should < 2
|
432
442
|
foundart = Article.get @art.id
|
metadata
CHANGED
@@ -4,13 +4,15 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
|
7
|
+
- 37
|
8
|
+
- 1
|
9
|
+
version: 0.37.1
|
9
10
|
platform: ruby
|
10
11
|
authors:
|
11
12
|
- J. Chris Anderson
|
12
13
|
- Matt Aimonetti
|
13
14
|
- Marcos Tapajos
|
15
|
+
- Will Leinweber
|
14
16
|
autorequire:
|
15
17
|
bindir: bin
|
16
18
|
cert_chain: []
|
@@ -59,6 +61,7 @@ files:
|
|
59
61
|
- README.md
|
60
62
|
- Rakefile
|
61
63
|
- THANKS.md
|
64
|
+
- couchrest.gemspec
|
62
65
|
- examples/model/example.rb
|
63
66
|
- examples/word_count/markov
|
64
67
|
- examples/word_count/views/books/chunked-map.js
|
@@ -101,6 +104,7 @@ files:
|
|
101
104
|
- lib/couchrest/mixins/validation.rb
|
102
105
|
- lib/couchrest/mixins/views.rb
|
103
106
|
- lib/couchrest/monkeypatches.rb
|
107
|
+
- lib/couchrest/more/casted_array.rb
|
104
108
|
- lib/couchrest/more/casted_model.rb
|
105
109
|
- lib/couchrest/more/extended_document.rb
|
106
110
|
- lib/couchrest/more/property.rb
|
@@ -190,34 +194,34 @@ signing_key:
|
|
190
194
|
specification_version: 3
|
191
195
|
summary: Lean and RESTful interface to CouchDB.
|
192
196
|
test_files:
|
193
|
-
- spec/couchrest/
|
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
|
194
205
|
- spec/couchrest/more/casted_extended_doc_spec.rb
|
195
|
-
- spec/couchrest/more/extended_doc_inherited_spec.rb
|
196
206
|
- spec/couchrest/more/casted_model_spec.rb
|
197
|
-
- spec/couchrest/more/
|
207
|
+
- spec/couchrest/more/extended_doc_attachment_spec.rb
|
208
|
+
- spec/couchrest/more/extended_doc_inherited_spec.rb
|
198
209
|
- spec/couchrest/more/extended_doc_spec.rb
|
199
|
-
- spec/couchrest/more/property_spec.rb
|
200
|
-
- spec/couchrest/more/attribute_protection_spec.rb
|
201
210
|
- spec/couchrest/more/extended_doc_subclass_spec.rb
|
202
|
-
- spec/couchrest/
|
203
|
-
- spec/couchrest/
|
204
|
-
- spec/
|
205
|
-
- spec/couchrest/core/server_spec.rb
|
206
|
-
- spec/couchrest/core/couchrest_spec.rb
|
207
|
-
- spec/couchrest/core/database_spec.rb
|
208
|
-
- spec/couchrest/core/document_spec.rb
|
209
|
-
- spec/fixtures/more/person.rb
|
210
|
-
- spec/fixtures/more/cat.rb
|
211
|
+
- spec/couchrest/more/extended_doc_view_spec.rb
|
212
|
+
- spec/couchrest/more/property_spec.rb
|
213
|
+
- spec/fixtures/more/article.rb
|
211
214
|
- spec/fixtures/more/card.rb
|
215
|
+
- spec/fixtures/more/cat.rb
|
212
216
|
- spec/fixtures/more/course.rb
|
213
|
-
- spec/fixtures/more/service.rb
|
214
|
-
- spec/fixtures/more/article.rb
|
215
|
-
- spec/fixtures/more/invoice.rb
|
216
|
-
- spec/fixtures/more/user.rb
|
217
217
|
- spec/fixtures/more/event.rb
|
218
|
+
- spec/fixtures/more/invoice.rb
|
219
|
+
- spec/fixtures/more/person.rb
|
218
220
|
- spec/fixtures/more/question.rb
|
221
|
+
- spec/fixtures/more/service.rb
|
222
|
+
- spec/fixtures/more/user.rb
|
219
223
|
- spec/spec_helper.rb
|
220
|
-
- examples/
|
224
|
+
- examples/model/example.rb
|
221
225
|
- examples/word_count/word_count.rb
|
222
226
|
- examples/word_count/word_count_query.rb
|
223
|
-
- examples/
|
227
|
+
- examples/word_count/word_count_views.rb
|