couchrest 0.35 → 0.36
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 +2 -2
- data/history.txt +10 -0
- data/lib/couchrest.rb +15 -12
- data/lib/couchrest/core/database.rb +25 -7
- data/lib/couchrest/mixins/collection.rb +45 -9
- data/lib/couchrest/mixins/properties.rb +11 -53
- data/lib/couchrest/monkeypatches.rb +1 -1
- data/lib/couchrest/more/extended_document.rb +5 -4
- data/lib/couchrest/more/property.rb +8 -9
- data/lib/couchrest/more/typecast.rb +180 -0
- data/lib/couchrest/validation/validators/required_field_validator.rb +2 -2
- data/spec/couchrest/core/couchrest_spec.rb +16 -79
- data/spec/couchrest/core/database_spec.rb +70 -3
- data/spec/couchrest/more/casted_model_spec.rb +1 -1
- data/spec/couchrest/more/extended_doc_spec.rb +58 -7
- data/spec/couchrest/more/property_spec.rb +424 -85
- data/spec/fixtures/more/article.rb +2 -2
- data/spec/fixtures/more/course.rb +13 -5
- data/spec/fixtures/more/event.rb +1 -2
- data/spec/fixtures/more/person.rb +1 -1
- data/spec/fixtures/more/question.rb +1 -1
- data/spec/fixtures/more/service.rb +1 -1
- data/spec/spec_helper.rb +13 -1
- metadata +27 -13
@@ -20,10 +20,10 @@ class Article < CouchRest::ExtendedDocument
|
|
20
20
|
return sum(values);
|
21
21
|
}"
|
22
22
|
|
23
|
-
property :date
|
23
|
+
property :date, :type => 'Date'
|
24
24
|
property :slug, :read_only => true
|
25
25
|
property :title
|
26
|
-
property :tags
|
26
|
+
property :tags, :type => ['String']
|
27
27
|
|
28
28
|
timestamps!
|
29
29
|
|
@@ -4,11 +4,19 @@ require File.join(FIXTURE_PATH, 'more', 'person')
|
|
4
4
|
class Course < CouchRest::ExtendedDocument
|
5
5
|
use_database TEST_SERVER.default_database
|
6
6
|
|
7
|
-
property :title
|
8
|
-
property :questions,
|
9
|
-
property :professor,
|
10
|
-
property :
|
7
|
+
property :title, :cast_as => 'String'
|
8
|
+
property :questions, :cast_as => ['Question']
|
9
|
+
property :professor, :cast_as => 'Person'
|
10
|
+
property :participants, :type => ['Object']
|
11
|
+
property :ends_at, :type => 'Time'
|
12
|
+
property :estimate, :type => 'Float'
|
13
|
+
property :hours, :type => 'Integer'
|
14
|
+
property :profit, :type => 'BigDecimal'
|
15
|
+
property :started_on, :type => 'Date'
|
16
|
+
property :updated_at, :type => 'DateTime'
|
17
|
+
property :active, :type => 'Boolean'
|
18
|
+
property :klass, :type => 'Class'
|
11
19
|
|
12
20
|
view_by :title
|
13
21
|
view_by :dept, :ducktype => true
|
14
|
-
end
|
22
|
+
end
|
data/spec/fixtures/more/event.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -10,6 +10,7 @@ unless defined?(FIXTURE_PATH)
|
|
10
10
|
|
11
11
|
COUCHHOST = "http://127.0.0.1:5984"
|
12
12
|
TESTDB = 'couchrest-test'
|
13
|
+
REPLICATIONDB = 'couchrest-test-replication'
|
13
14
|
TEST_SERVER = CouchRest.new
|
14
15
|
TEST_SERVER.default_database = TESTDB
|
15
16
|
DB = TEST_SERVER.database(TESTDB)
|
@@ -34,4 +35,15 @@ Spec::Runner.configure do |config|
|
|
34
35
|
cr.database(db).delete! rescue nil
|
35
36
|
end
|
36
37
|
end
|
37
|
-
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def couchdb_lucene_available?
|
41
|
+
lucene_path = "http://localhost:5985/"
|
42
|
+
url = URI.parse(lucene_path)
|
43
|
+
req = Net::HTTP::Get.new(url.path)
|
44
|
+
res = Net::HTTP.new(url.host, url.port).start { |http| http.request(req) }
|
45
|
+
true
|
46
|
+
rescue Exception => e
|
47
|
+
false
|
48
|
+
end
|
49
|
+
|
metadata
CHANGED
@@ -1,39 +1,50 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: couchrest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 36
|
8
|
+
version: "0.36"
|
5
9
|
platform: ruby
|
6
10
|
authors:
|
7
11
|
- J. Chris Anderson
|
8
12
|
- Matt Aimonetti
|
9
13
|
- Marcos Tapajos
|
14
|
+
- Will Leinweber
|
10
15
|
autorequire:
|
11
16
|
bindir: bin
|
12
17
|
cert_chain: []
|
13
18
|
|
14
|
-
date: 2010-
|
19
|
+
date: 2010-03-30 00:00:00 -03:00
|
15
20
|
default_executable:
|
16
21
|
dependencies:
|
17
22
|
- !ruby/object:Gem::Dependency
|
18
23
|
name: rest-client
|
19
|
-
|
20
|
-
|
21
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
22
26
|
requirements:
|
23
27
|
- - ">="
|
24
28
|
- !ruby/object:Gem::Version
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
- 5
|
25
32
|
version: "0.5"
|
26
|
-
|
33
|
+
type: :runtime
|
34
|
+
version_requirements: *id001
|
27
35
|
- !ruby/object:Gem::Dependency
|
28
36
|
name: mime-types
|
29
|
-
|
30
|
-
|
31
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
prerelease: false
|
38
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
32
39
|
requirements:
|
33
40
|
- - ">="
|
34
41
|
- !ruby/object:Gem::Version
|
42
|
+
segments:
|
43
|
+
- 1
|
44
|
+
- 15
|
35
45
|
version: "1.15"
|
36
|
-
|
46
|
+
type: :runtime
|
47
|
+
version_requirements: *id002
|
37
48
|
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.
|
38
49
|
email: jchris@apache.org
|
39
50
|
executables: []
|
@@ -94,6 +105,7 @@ files:
|
|
94
105
|
- lib/couchrest/more/casted_model.rb
|
95
106
|
- lib/couchrest/more/extended_document.rb
|
96
107
|
- lib/couchrest/more/property.rb
|
108
|
+
- lib/couchrest/more/typecast.rb
|
97
109
|
- lib/couchrest/support/blank.rb
|
98
110
|
- lib/couchrest/support/class.rb
|
99
111
|
- lib/couchrest/support/rails.rb
|
@@ -161,18 +173,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
161
173
|
requirements:
|
162
174
|
- - ">="
|
163
175
|
- !ruby/object:Gem::Version
|
176
|
+
segments:
|
177
|
+
- 0
|
164
178
|
version: "0"
|
165
|
-
version:
|
166
179
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
180
|
requirements:
|
168
181
|
- - ">="
|
169
182
|
- !ruby/object:Gem::Version
|
183
|
+
segments:
|
184
|
+
- 0
|
170
185
|
version: "0"
|
171
|
-
version:
|
172
186
|
requirements: []
|
173
187
|
|
174
188
|
rubyforge_project:
|
175
|
-
rubygems_version: 1.3.
|
189
|
+
rubygems_version: 1.3.6
|
176
190
|
signing_key:
|
177
191
|
specification_version: 3
|
178
192
|
summary: Lean and RESTful interface to CouchDB.
|