jrun-couchrest 0.2.1 → 0.2.1.1
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/lib/couchrest/core/database.rb +5 -2
- data/lib/couchrest.rb +1 -1
- data/spec/couchrest/more/casted_model_spec.rb +2 -1
- data/spec/couchrest/more/extended_doc_attachment_spec.rb +2 -1
- data/spec/couchrest/more/extended_doc_view_spec.rb +2 -1
- data/spec/couchrest/more/property_spec.rb +2 -1
- metadata +1 -21
|
@@ -61,12 +61,15 @@ module CouchRest
|
|
|
61
61
|
# paramaters as described in http://wiki.apache.org/couchdb/HttpViewApi
|
|
62
62
|
def view(name, params = {}, &block)
|
|
63
63
|
keys = params.delete(:keys)
|
|
64
|
-
|
|
64
|
+
name = name.split('/') # I think this will always be length == 2, but maybe not...
|
|
65
|
+
dname = name.shift
|
|
66
|
+
vname = name.join('/')
|
|
67
|
+
url = CouchRest.paramify_url "#{@uri}/_design/#{dname}/_view/#{vname}", params
|
|
65
68
|
if keys
|
|
66
69
|
CouchRest.post(url, {:keys => keys})
|
|
67
70
|
else
|
|
68
71
|
if block_given?
|
|
69
|
-
@streamer.view(
|
|
72
|
+
@streamer.view("_design/#{dname}/_view/#{vname}", params, &block)
|
|
70
73
|
else
|
|
71
74
|
CouchRest.get url
|
|
72
75
|
end
|
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.2.1' unless self.const_defined?("VERSION")
|
|
31
|
+
VERSION = '0.2.1.1' unless self.const_defined?("VERSION")
|
|
32
32
|
|
|
33
33
|
autoload :Server, 'couchrest/core/server'
|
|
34
34
|
autoload :Database, 'couchrest/core/database'
|
|
@@ -70,6 +70,7 @@ describe CouchRest::CastedModel do
|
|
|
70
70
|
|
|
71
71
|
describe "saved document with casted models" do
|
|
72
72
|
before(:each) do
|
|
73
|
+
reset_test_db!
|
|
73
74
|
@obj = DummyModel.new(:casted_attribute => {:name => 'whatever'})
|
|
74
75
|
@obj.save.should be_true
|
|
75
76
|
@obj = DummyModel.get(@obj.id)
|
|
@@ -94,4 +95,4 @@ describe CouchRest::CastedModel do
|
|
|
94
95
|
|
|
95
96
|
end
|
|
96
97
|
|
|
97
|
-
end
|
|
98
|
+
end
|
|
@@ -4,6 +4,7 @@ describe "ExtendedDocument attachments" do
|
|
|
4
4
|
|
|
5
5
|
describe "#has_attachment?" do
|
|
6
6
|
before(:each) do
|
|
7
|
+
reset_test_db!
|
|
7
8
|
@obj = Basic.new
|
|
8
9
|
@obj.save.should == true
|
|
9
10
|
@file = File.open(FIXTURE_PATH + '/attachments/test.html')
|
|
@@ -126,4 +127,4 @@ describe "ExtendedDocument attachments" do
|
|
|
126
127
|
@obj.attachment_url(@attachment_name).should == "#{Basic.database}/#{@obj.id}/#{@attachment_name}"
|
|
127
128
|
end
|
|
128
129
|
end
|
|
129
|
-
end
|
|
130
|
+
end
|
|
@@ -190,6 +190,7 @@ describe "ExtendedDocument views" do
|
|
|
190
190
|
|
|
191
191
|
describe "with a lot of designs left around" do
|
|
192
192
|
before(:each) do
|
|
193
|
+
reset_test_db!
|
|
193
194
|
Article.by_date
|
|
194
195
|
Article.view_by :field
|
|
195
196
|
Article.by_field
|
|
@@ -203,4 +204,4 @@ describe "ExtendedDocument views" do
|
|
|
203
204
|
ddocs["rows"].length.should == 1
|
|
204
205
|
end
|
|
205
206
|
end
|
|
206
|
-
end
|
|
207
|
+
end
|
|
@@ -8,6 +8,7 @@ require File.join(FIXTURE_PATH, 'more', 'event')
|
|
|
8
8
|
describe "ExtendedDocument properties" do
|
|
9
9
|
|
|
10
10
|
before(:each) do
|
|
11
|
+
reset_test_db!
|
|
11
12
|
@card = Card.new(:first_name => "matt")
|
|
12
13
|
end
|
|
13
14
|
|
|
@@ -126,4 +127,4 @@ describe "ExtendedDocument properties" do
|
|
|
126
127
|
end
|
|
127
128
|
end
|
|
128
129
|
|
|
129
|
-
end
|
|
130
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jrun-couchrest
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.1
|
|
4
|
+
version: 0.2.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- J. Chris Anderson
|
|
@@ -149,26 +149,6 @@ files:
|
|
|
149
149
|
- spec/fixtures/attachments/couchdb.png
|
|
150
150
|
- spec/fixtures/attachments/README
|
|
151
151
|
- spec/fixtures/attachments/test.html
|
|
152
|
-
- spec/fixtures/couchapp
|
|
153
|
-
- spec/fixtures/couchapp/_attachments
|
|
154
|
-
- spec/fixtures/couchapp/_attachments/index.html
|
|
155
|
-
- spec/fixtures/couchapp/doc.json
|
|
156
|
-
- spec/fixtures/couchapp/foo
|
|
157
|
-
- spec/fixtures/couchapp/foo/bar.txt
|
|
158
|
-
- spec/fixtures/couchapp/foo/test.json
|
|
159
|
-
- spec/fixtures/couchapp/test.json
|
|
160
|
-
- spec/fixtures/couchapp/views
|
|
161
|
-
- spec/fixtures/couchapp/views/example-map.js
|
|
162
|
-
- spec/fixtures/couchapp/views/example-reduce.js
|
|
163
|
-
- spec/fixtures/couchapp-test
|
|
164
|
-
- spec/fixtures/couchapp-test/my-app
|
|
165
|
-
- spec/fixtures/couchapp-test/my-app/_attachments
|
|
166
|
-
- spec/fixtures/couchapp-test/my-app/_attachments/index.html
|
|
167
|
-
- spec/fixtures/couchapp-test/my-app/foo
|
|
168
|
-
- spec/fixtures/couchapp-test/my-app/foo/bar.txt
|
|
169
|
-
- spec/fixtures/couchapp-test/my-app/views
|
|
170
|
-
- spec/fixtures/couchapp-test/my-app/views/example-map.js
|
|
171
|
-
- spec/fixtures/couchapp-test/my-app/views/example-reduce.js
|
|
172
152
|
- spec/fixtures/more
|
|
173
153
|
- spec/fixtures/more/article.rb
|
|
174
154
|
- spec/fixtures/more/card.rb
|