dolly 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/dolly/document.rb +4 -0
- data/lib/dolly/version.rb +1 -1
- data/lib/tasks/db.rake +6 -1
- data/test/document_test.rb +9 -0
- data/test/dummy/log/test.log +1386 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: deab5211996013fda5d0ee9e44bf4c6cc1c18d1d
|
4
|
+
data.tar.gz: bc5266dbcb192446a7ec0592523b2892a7a388f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9724e760d84370771d39ca241781bcf2d8ee6dad7da8955521bbdc8ddd8e61813d6f2f8f6eb6f3cfe61e93b0219904c3e09c0ffb9811f3a24318f1357cd58b85
|
7
|
+
data.tar.gz: 8036a2ac3b9bc801ccc5a342955c49676fff02b60586bd6cf8ba81a1f6c3b2e90d70deb7bfd9e4dfad3ba995dfbe5f3bbb4c241a26c82eb290a65ee2d819a65f
|
data/lib/dolly/document.rb
CHANGED
@@ -79,6 +79,10 @@ module Dolly
|
|
79
79
|
raise Dolly::ResourceNotFound if col.empty?
|
80
80
|
col.each{ |r| @doc = r['doc'] }
|
81
81
|
_properties.each do |p|
|
82
|
+
#TODO: Refactor properties so it is not required
|
83
|
+
#to be a class property. But something that doesn't
|
84
|
+
#persist all the inheretence chain
|
85
|
+
next unless self.respond_to? :"#{p.name}="
|
82
86
|
self.send "#{p.name}=", doc[p.name]
|
83
87
|
end
|
84
88
|
@rows = col
|
data/lib/dolly/version.rb
CHANGED
data/lib/tasks/db.rake
CHANGED
@@ -19,10 +19,15 @@ namespace :db do
|
|
19
19
|
key ||= 'map'
|
20
20
|
source = File.read filename
|
21
21
|
|
22
|
-
vd = data[design_doc_name] ||= { 'views' => {}, 'filters' => {} }
|
22
|
+
vd = data[design_doc_name] ||= { 'views' => {}, 'filters' => {}, 'lists' => {}, 'lib' => {} }
|
23
23
|
|
24
24
|
if key == 'filter'
|
25
25
|
vd['filters'][name] = source
|
26
|
+
elsif key == 'lists'
|
27
|
+
vd['lists'][name] = source
|
28
|
+
elsif key == 'lib'
|
29
|
+
v = vd['views']['lib'] ||= {}
|
30
|
+
v[name] = source
|
26
31
|
else
|
27
32
|
v = vd['views'][name] ||= {}
|
28
33
|
v[key] = source
|
data/test/document_test.rb
CHANGED
@@ -49,6 +49,10 @@ class DocWithSameDefaults < Dolly::Document
|
|
49
49
|
property :foo, :bar, class_name: Array, default: []
|
50
50
|
end
|
51
51
|
|
52
|
+
class Bar < FooBar
|
53
|
+
property :a, :b
|
54
|
+
end
|
55
|
+
|
52
56
|
class DocumentTest < ActiveSupport::TestCase
|
53
57
|
DB_BASE_PATH = "http://localhost:5984/test".freeze
|
54
58
|
|
@@ -467,6 +471,11 @@ class DocumentTest < ActiveSupport::TestCase
|
|
467
471
|
assert_equal Base64.encode64(data), doc.doc['_attachments']['test.txt']['data']
|
468
472
|
end
|
469
473
|
|
474
|
+
test "new object from inhereted document" do
|
475
|
+
assert bar = Bar.new(a: 1)
|
476
|
+
assert_equal 1, bar.a
|
477
|
+
end
|
478
|
+
|
470
479
|
private
|
471
480
|
def generic_response rows, count = 1
|
472
481
|
{total_rows: count, offset:0, rows: rows}
|