couch-client 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1 -0
- data/LICENSE +22 -0
- data/Manifest +33 -0
- data/README.markdown +176 -0
- data/Rakefile +17 -0
- data/TODO +11 -0
- data/couch-client.gemspec +33 -0
- data/lib/couch-client.rb +50 -0
- data/lib/couch-client/attachment.rb +32 -0
- data/lib/couch-client/attachment_list.rb +10 -0
- data/lib/couch-client/collection.rb +20 -0
- data/lib/couch-client/connection.rb +104 -0
- data/lib/couch-client/connection_handler.rb +70 -0
- data/lib/couch-client/consistent_hash.rb +98 -0
- data/lib/couch-client/database.rb +39 -0
- data/lib/couch-client/design.rb +79 -0
- data/lib/couch-client/document.rb +151 -0
- data/lib/couch-client/hookup.rb +107 -0
- data/lib/couch-client/row.rb +10 -0
- data/spec/attachment_list_spec.rb +7 -0
- data/spec/attachment_spec.rb +57 -0
- data/spec/collection_spec.rb +43 -0
- data/spec/conection_handler_spec.rb +66 -0
- data/spec/connection_spec.rb +93 -0
- data/spec/consistent_hash_spec.rb +171 -0
- data/spec/couch-client_spec.rb +11 -0
- data/spec/database_spec.rb +44 -0
- data/spec/design_spec.rb +100 -0
- data/spec/document_spec.rb +196 -0
- data/spec/files/image.png +0 -0
- data/spec/files/plain.txt +1 -0
- data/spec/hookup_spec.rb +122 -0
- data/spec/row_spec.rb +35 -0
- data/spec/spec_helper.rb +11 -0
- metadata +130 -0
data/spec/row_spec.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.join(File.dirname(File.expand_path(__FILE__)), "spec_helper")
|
2
|
+
|
3
|
+
describe CouchClient::Row do
|
4
|
+
before(:all) do
|
5
|
+
@couch = CouchClient.connect(COUCHDB_TEST_SETTINGS)
|
6
|
+
@couch.database.create
|
7
|
+
|
8
|
+
factory = lambda do |hash|
|
9
|
+
doc = @couch.build(hash)
|
10
|
+
doc.save
|
11
|
+
doc
|
12
|
+
end
|
13
|
+
|
14
|
+
@alice = factory.call({"_id" => "123", "name" => "alice", "city" => "nyc"})
|
15
|
+
@design = factory.call({"_id" => "_design/people",
|
16
|
+
"views" => {
|
17
|
+
"all" => {"map" => "function(doc){emit(doc._id, doc)}"}
|
18
|
+
}
|
19
|
+
})
|
20
|
+
|
21
|
+
@people = @couch.design("people").view("all", "include_docs" => true)
|
22
|
+
end
|
23
|
+
|
24
|
+
after(:all) do
|
25
|
+
@couch.database.delete!
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'should be an CouchClient::Row object' do
|
29
|
+
@people.first.should be_a_kind_of(CouchClient::Row)
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should have a document as a CouchClient::Document object' do
|
33
|
+
@people.first["doc"].should be_a_kind_of(CouchClient::Document)
|
34
|
+
end
|
35
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rspec'
|
3
|
+
|
4
|
+
Rspec.configure do |c|
|
5
|
+
c.mock_with :rspec
|
6
|
+
end
|
7
|
+
|
8
|
+
COUCHDB_TEST_SETTINGS = {:database => "couch-client_test"}
|
9
|
+
COUCHDB_TEST_DATABASE = COUCHDB_TEST_SETTINGS[:database]
|
10
|
+
|
11
|
+
require File.join(File.dirname(File.expand_path(__FILE__)), "..", "lib", "couch-client")
|
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: couch-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 0.0.1
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Robert Sosinski
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-10-29 00:00:00 -04:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: json
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
31
|
+
type: :runtime
|
32
|
+
version_requirements: *id001
|
33
|
+
description: CouchClient is Ruby library that can be used to interact with CouchDB
|
34
|
+
email: email@robertsosinski.com
|
35
|
+
executables: []
|
36
|
+
|
37
|
+
extensions: []
|
38
|
+
|
39
|
+
extra_rdoc_files:
|
40
|
+
- CHANGELOG
|
41
|
+
- LICENSE
|
42
|
+
- README.markdown
|
43
|
+
- TODO
|
44
|
+
- lib/couch-client.rb
|
45
|
+
- lib/couch-client/attachment.rb
|
46
|
+
- lib/couch-client/attachment_list.rb
|
47
|
+
- lib/couch-client/collection.rb
|
48
|
+
- lib/couch-client/connection.rb
|
49
|
+
- lib/couch-client/connection_handler.rb
|
50
|
+
- lib/couch-client/consistent_hash.rb
|
51
|
+
- lib/couch-client/database.rb
|
52
|
+
- lib/couch-client/design.rb
|
53
|
+
- lib/couch-client/document.rb
|
54
|
+
- lib/couch-client/hookup.rb
|
55
|
+
- lib/couch-client/row.rb
|
56
|
+
files:
|
57
|
+
- CHANGELOG
|
58
|
+
- LICENSE
|
59
|
+
- Manifest
|
60
|
+
- README.markdown
|
61
|
+
- Rakefile
|
62
|
+
- TODO
|
63
|
+
- lib/couch-client.rb
|
64
|
+
- lib/couch-client/attachment.rb
|
65
|
+
- lib/couch-client/attachment_list.rb
|
66
|
+
- lib/couch-client/collection.rb
|
67
|
+
- lib/couch-client/connection.rb
|
68
|
+
- lib/couch-client/connection_handler.rb
|
69
|
+
- lib/couch-client/consistent_hash.rb
|
70
|
+
- lib/couch-client/database.rb
|
71
|
+
- lib/couch-client/design.rb
|
72
|
+
- lib/couch-client/document.rb
|
73
|
+
- lib/couch-client/hookup.rb
|
74
|
+
- lib/couch-client/row.rb
|
75
|
+
- spec/attachment_list_spec.rb
|
76
|
+
- spec/attachment_spec.rb
|
77
|
+
- spec/collection_spec.rb
|
78
|
+
- spec/conection_handler_spec.rb
|
79
|
+
- spec/connection_spec.rb
|
80
|
+
- spec/consistent_hash_spec.rb
|
81
|
+
- spec/couch-client_spec.rb
|
82
|
+
- spec/database_spec.rb
|
83
|
+
- spec/design_spec.rb
|
84
|
+
- spec/document_spec.rb
|
85
|
+
- spec/files/image.png
|
86
|
+
- spec/files/plain.txt
|
87
|
+
- spec/hookup_spec.rb
|
88
|
+
- spec/row_spec.rb
|
89
|
+
- spec/spec_helper.rb
|
90
|
+
- couch-client.gemspec
|
91
|
+
has_rdoc: true
|
92
|
+
homepage: http://github.com/robertsosinski/couch-client
|
93
|
+
licenses: []
|
94
|
+
|
95
|
+
post_install_message:
|
96
|
+
rdoc_options:
|
97
|
+
- --line-numbers
|
98
|
+
- --inline-source
|
99
|
+
- --title
|
100
|
+
- Couch-client
|
101
|
+
- --main
|
102
|
+
- README.markdown
|
103
|
+
require_paths:
|
104
|
+
- lib
|
105
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
segments:
|
111
|
+
- 0
|
112
|
+
version: "0"
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
segments:
|
119
|
+
- 1
|
120
|
+
- 2
|
121
|
+
version: "1.2"
|
122
|
+
requirements: []
|
123
|
+
|
124
|
+
rubyforge_project: couch-client
|
125
|
+
rubygems_version: 1.3.7
|
126
|
+
signing_key:
|
127
|
+
specification_version: 3
|
128
|
+
summary: The goal of CouchClient is to make documents feel as much as possible as what they already represent, a Hash of primitives, Arrays and other Hashes.
|
129
|
+
test_files: []
|
130
|
+
|