ripple 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. data/.document +5 -0
  2. data/.gitignore +26 -0
  3. data/LICENSE +13 -0
  4. data/README.textile +126 -0
  5. data/RELEASE_NOTES.textile +24 -0
  6. data/Rakefile +61 -0
  7. data/VERSION +1 -0
  8. data/lib/riak.rb +45 -0
  9. data/lib/riak/bucket.rb +105 -0
  10. data/lib/riak/client.rb +138 -0
  11. data/lib/riak/client/curb_backend.rb +63 -0
  12. data/lib/riak/client/http_backend.rb +209 -0
  13. data/lib/riak/client/net_http_backend.rb +49 -0
  14. data/lib/riak/failed_request.rb +37 -0
  15. data/lib/riak/i18n.rb +15 -0
  16. data/lib/riak/invalid_response.rb +25 -0
  17. data/lib/riak/link.rb +54 -0
  18. data/lib/riak/locale/en.yml +37 -0
  19. data/lib/riak/map_reduce.rb +240 -0
  20. data/lib/riak/map_reduce_error.rb +20 -0
  21. data/lib/riak/robject.rb +234 -0
  22. data/lib/riak/util/headers.rb +44 -0
  23. data/lib/riak/util/multipart.rb +52 -0
  24. data/lib/riak/util/translation.rb +29 -0
  25. data/lib/riak/walk_spec.rb +113 -0
  26. data/lib/ripple.rb +48 -0
  27. data/lib/ripple/core_ext/casting.rb +96 -0
  28. data/lib/ripple/document.rb +60 -0
  29. data/lib/ripple/document/attribute_methods.rb +111 -0
  30. data/lib/ripple/document/attribute_methods/dirty.rb +52 -0
  31. data/lib/ripple/document/attribute_methods/query.rb +49 -0
  32. data/lib/ripple/document/attribute_methods/read.rb +38 -0
  33. data/lib/ripple/document/attribute_methods/write.rb +36 -0
  34. data/lib/ripple/document/bucket_access.rb +38 -0
  35. data/lib/ripple/document/finders.rb +84 -0
  36. data/lib/ripple/document/persistence.rb +93 -0
  37. data/lib/ripple/document/persistence/callbacks.rb +48 -0
  38. data/lib/ripple/document/properties.rb +85 -0
  39. data/lib/ripple/document/validations.rb +44 -0
  40. data/lib/ripple/embedded_document.rb +38 -0
  41. data/lib/ripple/embedded_document/persistence.rb +46 -0
  42. data/lib/ripple/i18n.rb +15 -0
  43. data/lib/ripple/locale/en.yml +16 -0
  44. data/lib/ripple/property_type_mismatch.rb +23 -0
  45. data/lib/ripple/translation.rb +24 -0
  46. data/ripple.gemspec +159 -0
  47. data/spec/fixtures/cat.jpg +0 -0
  48. data/spec/fixtures/multipart-blank.txt +7 -0
  49. data/spec/fixtures/multipart-with-body.txt +16 -0
  50. data/spec/riak/bucket_spec.rb +141 -0
  51. data/spec/riak/client_spec.rb +169 -0
  52. data/spec/riak/curb_backend_spec.rb +50 -0
  53. data/spec/riak/headers_spec.rb +34 -0
  54. data/spec/riak/http_backend_spec.rb +136 -0
  55. data/spec/riak/link_spec.rb +50 -0
  56. data/spec/riak/map_reduce_spec.rb +347 -0
  57. data/spec/riak/multipart_spec.rb +36 -0
  58. data/spec/riak/net_http_backend_spec.rb +28 -0
  59. data/spec/riak/object_spec.rb +444 -0
  60. data/spec/riak/walk_spec_spec.rb +208 -0
  61. data/spec/ripple/attribute_methods_spec.rb +149 -0
  62. data/spec/ripple/bucket_access_spec.rb +48 -0
  63. data/spec/ripple/callbacks_spec.rb +86 -0
  64. data/spec/ripple/document_spec.rb +35 -0
  65. data/spec/ripple/embedded_document_spec.rb +52 -0
  66. data/spec/ripple/finders_spec.rb +146 -0
  67. data/spec/ripple/persistence_spec.rb +89 -0
  68. data/spec/ripple/properties_spec.rb +195 -0
  69. data/spec/ripple/ripple_spec.rb +43 -0
  70. data/spec/ripple/validations_spec.rb +64 -0
  71. data/spec/spec.opts +1 -0
  72. data/spec/spec_helper.rb +32 -0
  73. data/spec/support/http_backend_implementation_examples.rb +215 -0
  74. data/spec/support/mock_server.rb +58 -0
  75. metadata +221 -0
@@ -0,0 +1,58 @@
1
+ # Copyright 2010 Sean Cribbs, Sonian Inc., and Basho Technologies, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # Based on code from Rob Styles and Chris Tierney found at:
16
+ # http://dynamicorange.com/2009/02/18/ruby-mock-web-server/
17
+ require 'rack'
18
+
19
+ class MockServer
20
+ def initialize(port = 4000, pause = 1)
21
+ @block = nil
22
+ @parent_thread = Thread.current
23
+ @thread = Thread.new do
24
+ Rack::Handler::WEBrick.run(self, :Port => port, :AccessLog => [], :Logger => NullLogger.new)
25
+ end
26
+ sleep pause # give the server time to fire up… YUK!
27
+ end
28
+
29
+ def stop
30
+ Thread.kill(@thread)
31
+ end
32
+
33
+ def attach(&block)
34
+ @block = block
35
+ end
36
+
37
+ def detach()
38
+ @block = nil
39
+ end
40
+
41
+ def call(env)
42
+ begin
43
+ raise "Specify a handler for the request using attach(block), the block should return a valid rack response and can test expectations" unless @block
44
+ @block.call(env)
45
+ rescue Exception => e
46
+ @parent_thread.raise e
47
+ [ 500, { 'Content-Type' => 'text/plain', 'Content-Length' => '13' }, [ 'Bad test code' ]]
48
+ end
49
+ end
50
+
51
+ class NullLogger
52
+ def fatal(msg) end
53
+ def error(msg) end
54
+ def warn(msg) end
55
+ def info(msg) end
56
+ def debug(msg) end
57
+ end
58
+ end
metadata ADDED
@@ -0,0 +1,221 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ripple
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0
5
+ platform: ruby
6
+ authors:
7
+ - Sean Cribbs
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-02-10 00:00:00 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rspec
17
+ type: :development
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: "1.3"
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: fakeweb
27
+ type: :development
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: "1.2"
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: rack
37
+ type: :development
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: "1.0"
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: yard
47
+ type: :development
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 0.5.2
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: curb
57
+ type: :development
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ version: "0.6"
64
+ version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: activesupport
67
+ type: :runtime
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "="
72
+ - !ruby/object:Gem::Version
73
+ version: 3.0.0.beta
74
+ version:
75
+ - !ruby/object:Gem::Dependency
76
+ name: activemodel
77
+ type: :runtime
78
+ version_requirement:
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "="
82
+ - !ruby/object:Gem::Version
83
+ version: 3.0.0.beta
84
+ version:
85
+ description: ripple is a rich Ruby client for Riak, Basho's distributed database. It includes all the basics of accessing and manipulating Riak buckets and objects, and an object mapper library for building a rich domain on top of Riak.
86
+ email: seancribbs@gmail.com
87
+ executables: []
88
+
89
+ extensions: []
90
+
91
+ extra_rdoc_files:
92
+ - LICENSE
93
+ - README.textile
94
+ files:
95
+ - .document
96
+ - .gitignore
97
+ - LICENSE
98
+ - README.textile
99
+ - RELEASE_NOTES.textile
100
+ - Rakefile
101
+ - VERSION
102
+ - lib/riak.rb
103
+ - lib/riak/bucket.rb
104
+ - lib/riak/client.rb
105
+ - lib/riak/client/curb_backend.rb
106
+ - lib/riak/client/http_backend.rb
107
+ - lib/riak/client/net_http_backend.rb
108
+ - lib/riak/failed_request.rb
109
+ - lib/riak/i18n.rb
110
+ - lib/riak/invalid_response.rb
111
+ - lib/riak/link.rb
112
+ - lib/riak/locale/en.yml
113
+ - lib/riak/map_reduce.rb
114
+ - lib/riak/map_reduce_error.rb
115
+ - lib/riak/robject.rb
116
+ - lib/riak/util/headers.rb
117
+ - lib/riak/util/multipart.rb
118
+ - lib/riak/util/translation.rb
119
+ - lib/riak/walk_spec.rb
120
+ - lib/ripple.rb
121
+ - lib/ripple/core_ext/casting.rb
122
+ - lib/ripple/document.rb
123
+ - lib/ripple/document/attribute_methods.rb
124
+ - lib/ripple/document/attribute_methods/dirty.rb
125
+ - lib/ripple/document/attribute_methods/query.rb
126
+ - lib/ripple/document/attribute_methods/read.rb
127
+ - lib/ripple/document/attribute_methods/write.rb
128
+ - lib/ripple/document/bucket_access.rb
129
+ - lib/ripple/document/finders.rb
130
+ - lib/ripple/document/persistence.rb
131
+ - lib/ripple/document/persistence/callbacks.rb
132
+ - lib/ripple/document/properties.rb
133
+ - lib/ripple/document/validations.rb
134
+ - lib/ripple/embedded_document.rb
135
+ - lib/ripple/embedded_document/persistence.rb
136
+ - lib/ripple/i18n.rb
137
+ - lib/ripple/locale/en.yml
138
+ - lib/ripple/property_type_mismatch.rb
139
+ - lib/ripple/translation.rb
140
+ - ripple.gemspec
141
+ - spec/fixtures/cat.jpg
142
+ - spec/fixtures/multipart-blank.txt
143
+ - spec/fixtures/multipart-with-body.txt
144
+ - spec/riak/bucket_spec.rb
145
+ - spec/riak/client_spec.rb
146
+ - spec/riak/curb_backend_spec.rb
147
+ - spec/riak/headers_spec.rb
148
+ - spec/riak/http_backend_spec.rb
149
+ - spec/riak/link_spec.rb
150
+ - spec/riak/map_reduce_spec.rb
151
+ - spec/riak/multipart_spec.rb
152
+ - spec/riak/net_http_backend_spec.rb
153
+ - spec/riak/object_spec.rb
154
+ - spec/riak/walk_spec_spec.rb
155
+ - spec/ripple/attribute_methods_spec.rb
156
+ - spec/ripple/bucket_access_spec.rb
157
+ - spec/ripple/callbacks_spec.rb
158
+ - spec/ripple/document_spec.rb
159
+ - spec/ripple/embedded_document_spec.rb
160
+ - spec/ripple/finders_spec.rb
161
+ - spec/ripple/persistence_spec.rb
162
+ - spec/ripple/properties_spec.rb
163
+ - spec/ripple/ripple_spec.rb
164
+ - spec/ripple/validations_spec.rb
165
+ - spec/spec.opts
166
+ - spec/spec_helper.rb
167
+ - spec/support/http_backend_implementation_examples.rb
168
+ - spec/support/mock_server.rb
169
+ has_rdoc: true
170
+ homepage: http://seancribbs.github.com/ripple
171
+ licenses: []
172
+
173
+ post_install_message:
174
+ rdoc_options:
175
+ - --charset=UTF-8
176
+ require_paths:
177
+ - lib
178
+ required_ruby_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ version: "0"
183
+ version:
184
+ required_rubygems_version: !ruby/object:Gem::Requirement
185
+ requirements:
186
+ - - ">="
187
+ - !ruby/object:Gem::Version
188
+ version: "0"
189
+ version:
190
+ requirements:
191
+ - `gem install curb` for better HTTP performance
192
+ rubyforge_project:
193
+ rubygems_version: 1.3.5
194
+ signing_key:
195
+ specification_version: 3
196
+ summary: ripple is a rich Ruby client for Riak, Basho's distributed database.
197
+ test_files:
198
+ - spec/riak/bucket_spec.rb
199
+ - spec/riak/client_spec.rb
200
+ - spec/riak/curb_backend_spec.rb
201
+ - spec/riak/headers_spec.rb
202
+ - spec/riak/http_backend_spec.rb
203
+ - spec/riak/link_spec.rb
204
+ - spec/riak/map_reduce_spec.rb
205
+ - spec/riak/multipart_spec.rb
206
+ - spec/riak/net_http_backend_spec.rb
207
+ - spec/riak/object_spec.rb
208
+ - spec/riak/walk_spec_spec.rb
209
+ - spec/ripple/attribute_methods_spec.rb
210
+ - spec/ripple/bucket_access_spec.rb
211
+ - spec/ripple/callbacks_spec.rb
212
+ - spec/ripple/document_spec.rb
213
+ - spec/ripple/embedded_document_spec.rb
214
+ - spec/ripple/finders_spec.rb
215
+ - spec/ripple/persistence_spec.rb
216
+ - spec/ripple/properties_spec.rb
217
+ - spec/ripple/ripple_spec.rb
218
+ - spec/ripple/validations_spec.rb
219
+ - spec/spec_helper.rb
220
+ - spec/support/http_backend_implementation_examples.rb
221
+ - spec/support/mock_server.rb