dynamoid 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +4 -0
- data/Gemfile +3 -2
- data/Gemfile.lock +40 -45
- data/README.markdown +55 -25
- data/Rakefile +31 -0
- data/VERSION +1 -1
- data/doc/Dynamoid.html +58 -42
- data/doc/Dynamoid/Adapter.html +666 -179
- data/doc/Dynamoid/Adapter/AwsSdk.html +752 -236
- data/doc/Dynamoid/Associations.html +28 -21
- data/doc/Dynamoid/Associations/Association.html +102 -49
- data/doc/Dynamoid/Associations/BelongsTo.html +28 -25
- data/doc/Dynamoid/Associations/ClassMethods.html +95 -52
- data/doc/Dynamoid/Associations/HasAndBelongsToMany.html +28 -25
- data/doc/Dynamoid/Associations/HasMany.html +28 -25
- data/doc/Dynamoid/Associations/HasOne.html +28 -25
- data/doc/Dynamoid/Associations/ManyAssociation.html +138 -94
- data/doc/Dynamoid/Associations/SingleAssociation.html +67 -38
- data/doc/Dynamoid/Components.html +60 -22
- data/doc/Dynamoid/Config.html +61 -44
- data/doc/Dynamoid/Config/Options.html +90 -61
- data/doc/Dynamoid/Criteria.html +28 -21
- data/doc/Dynamoid/Criteria/Chain.html +508 -100
- data/doc/Dynamoid/Criteria/ClassMethods.html +26 -19
- data/doc/Dynamoid/Dirty.html +424 -0
- data/doc/Dynamoid/Dirty/ClassMethods.html +174 -0
- data/doc/Dynamoid/Document.html +451 -84
- data/doc/Dynamoid/Document/ClassMethods.html +281 -102
- data/doc/Dynamoid/Errors.html +29 -22
- data/doc/Dynamoid/Errors/ConditionalCheckFailedException.html +141 -0
- data/doc/Dynamoid/Errors/DocumentNotValid.html +36 -25
- data/doc/Dynamoid/Errors/Error.html +27 -20
- data/doc/Dynamoid/Errors/InvalidField.html +27 -19
- data/doc/Dynamoid/Errors/InvalidQuery.html +131 -0
- data/doc/Dynamoid/Errors/MissingRangeKey.html +27 -19
- data/doc/Dynamoid/Fields.html +94 -77
- data/doc/Dynamoid/Fields/ClassMethods.html +166 -37
- data/doc/Dynamoid/Finders.html +28 -21
- data/doc/Dynamoid/Finders/ClassMethods.html +505 -78
- data/doc/Dynamoid/IdentityMap.html +492 -0
- data/doc/Dynamoid/IdentityMap/ClassMethods.html +534 -0
- data/doc/Dynamoid/Indexes.html +41 -28
- data/doc/Dynamoid/Indexes/ClassMethods.html +45 -29
- data/doc/Dynamoid/Indexes/Index.html +100 -62
- data/doc/Dynamoid/Middleware.html +115 -0
- data/doc/Dynamoid/Middleware/IdentityMap.html +264 -0
- data/doc/Dynamoid/Persistence.html +326 -85
- data/doc/Dynamoid/Persistence/ClassMethods.html +275 -109
- data/doc/Dynamoid/Validations.html +47 -31
- data/doc/_index.html +116 -71
- data/doc/class_list.html +13 -7
- data/doc/css/full_list.css +4 -2
- data/doc/css/style.css +60 -44
- data/doc/file.LICENSE.html +26 -19
- data/doc/file.README.html +152 -48
- data/doc/file_list.html +14 -8
- data/doc/frames.html +20 -5
- data/doc/index.html +152 -48
- data/doc/js/app.js +52 -43
- data/doc/js/full_list.js +14 -9
- data/doc/js/jquery.js +4 -16
- data/doc/method_list.html +446 -540
- data/doc/top-level-namespace.html +27 -20
- data/{Dynamoid.gemspec → dynamoid.gemspec} +21 -8
- data/lib/dynamoid/adapter.rb +11 -10
- data/lib/dynamoid/adapter/aws_sdk.rb +40 -19
- data/lib/dynamoid/components.rb +2 -1
- data/lib/dynamoid/criteria/chain.rb +29 -11
- data/lib/dynamoid/dirty.rb +6 -0
- data/lib/dynamoid/document.rb +34 -19
- data/lib/dynamoid/fields.rb +36 -30
- data/lib/dynamoid/finders.rb +7 -5
- data/lib/dynamoid/persistence.rb +37 -10
- data/spec/app/models/address.rb +2 -0
- data/spec/app/models/camel_case.rb +10 -0
- data/spec/app/models/car.rb +6 -0
- data/spec/app/models/nuclear_submarine.rb +5 -0
- data/spec/app/models/subscription.rb +2 -2
- data/spec/app/models/vehicle.rb +7 -0
- data/spec/dynamoid/adapter/aws_sdk_spec.rb +20 -11
- data/spec/dynamoid/adapter_spec.rb +67 -82
- data/spec/dynamoid/associations/association_spec.rb +30 -30
- data/spec/dynamoid/criteria/chain_spec.rb +56 -9
- data/spec/dynamoid/criteria_spec.rb +3 -0
- data/spec/dynamoid/dirty_spec.rb +8 -0
- data/spec/dynamoid/document_spec.rb +109 -47
- data/spec/dynamoid/fields_spec.rb +32 -3
- data/spec/dynamoid/finders_spec.rb +12 -0
- data/spec/dynamoid/persistence_spec.rb +73 -8
- data/spec/spec_helper.rb +1 -0
- data/spec/support/with_partitioning.rb +15 -0
- metadata +22 -9
data/.travis.yml
ADDED
data/Gemfile
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
source "
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
2
3
|
gem 'activemodel'
|
3
4
|
gem 'tzinfo'
|
4
5
|
gem 'aws-sdk'
|
@@ -18,6 +19,6 @@ group :development do
|
|
18
19
|
gem "redcarpet", '1.17.2'
|
19
20
|
gem 'github-markup'
|
20
21
|
gem 'pry'
|
21
|
-
gem 'fake_dynamo'
|
22
|
+
gem 'fake_dynamo', '~>0.1.3'
|
22
23
|
gem "mocha", '0.10.0'
|
23
24
|
end
|
data/Gemfile.lock
CHANGED
@@ -1,71 +1,66 @@
|
|
1
1
|
GEM
|
2
|
-
remote:
|
2
|
+
remote: https://rubygems.org/
|
3
3
|
specs:
|
4
|
-
activemodel (3.2.
|
5
|
-
activesupport (= 3.2.
|
4
|
+
activemodel (3.2.13)
|
5
|
+
activesupport (= 3.2.13)
|
6
6
|
builder (~> 3.0.0)
|
7
|
-
activesupport (3.2.
|
8
|
-
i18n (
|
7
|
+
activesupport (3.2.13)
|
8
|
+
i18n (= 0.6.1)
|
9
9
|
multi_json (~> 1.0)
|
10
|
-
aws-sdk (1.
|
11
|
-
httparty (~> 0.7)
|
10
|
+
aws-sdk (1.10.0)
|
12
11
|
json (~> 1.4)
|
13
12
|
nokogiri (>= 1.4.4)
|
14
13
|
uuidtools (~> 2.1)
|
15
|
-
builder (3.0.
|
16
|
-
coderay (1.0.
|
17
|
-
diff-lcs (1.
|
18
|
-
fake_dynamo (0.
|
14
|
+
builder (3.0.4)
|
15
|
+
coderay (1.0.9)
|
16
|
+
diff-lcs (1.2.4)
|
17
|
+
fake_dynamo (0.1.3)
|
19
18
|
activesupport
|
20
19
|
json
|
21
20
|
sinatra
|
22
21
|
git (1.2.5)
|
23
|
-
github-markup (0.7.
|
24
|
-
|
25
|
-
multi_json (~> 1.0)
|
26
|
-
multi_xml
|
27
|
-
i18n (0.6.0)
|
22
|
+
github-markup (0.7.5)
|
23
|
+
i18n (0.6.1)
|
28
24
|
jeweler (1.8.4)
|
29
25
|
bundler (~> 1.0)
|
30
26
|
git (>= 1.2.5)
|
31
27
|
rake
|
32
28
|
rdoc
|
33
|
-
json (1.
|
29
|
+
json (1.8.0)
|
34
30
|
metaclass (0.0.1)
|
35
|
-
method_source (0.8)
|
31
|
+
method_source (0.8.1)
|
36
32
|
mocha (0.10.0)
|
37
33
|
metaclass (~> 0.0.1)
|
38
|
-
multi_json (1.3
|
39
|
-
|
40
|
-
|
41
|
-
pry (0.9.10)
|
34
|
+
multi_json (1.7.3)
|
35
|
+
nokogiri (1.5.9)
|
36
|
+
pry (0.9.12.2)
|
42
37
|
coderay (~> 1.0.5)
|
43
38
|
method_source (~> 0.8)
|
44
|
-
slop (~> 3.
|
45
|
-
rack (1.
|
46
|
-
rack-protection (1.
|
39
|
+
slop (~> 3.4)
|
40
|
+
rack (1.5.2)
|
41
|
+
rack-protection (1.5.0)
|
47
42
|
rack
|
48
|
-
rake (0.
|
49
|
-
rdoc (
|
43
|
+
rake (10.0.4)
|
44
|
+
rdoc (4.0.1)
|
50
45
|
json (~> 1.4)
|
51
46
|
redcarpet (1.17.2)
|
52
|
-
rspec (2.
|
53
|
-
rspec-core (~> 2.
|
54
|
-
rspec-expectations (~> 2.
|
55
|
-
rspec-mocks (~> 2.
|
56
|
-
rspec-core (2.
|
57
|
-
rspec-expectations (2.
|
58
|
-
diff-lcs (
|
59
|
-
rspec-mocks (2.
|
60
|
-
sinatra (1.
|
61
|
-
rack (~> 1.
|
62
|
-
rack-protection (~> 1.
|
63
|
-
tilt (~> 1.3, >= 1.3.
|
64
|
-
slop (3.
|
65
|
-
tilt (1.
|
66
|
-
tzinfo (0.3.
|
67
|
-
uuidtools (2.1.
|
68
|
-
yard (0.8.
|
47
|
+
rspec (2.13.0)
|
48
|
+
rspec-core (~> 2.13.0)
|
49
|
+
rspec-expectations (~> 2.13.0)
|
50
|
+
rspec-mocks (~> 2.13.0)
|
51
|
+
rspec-core (2.13.1)
|
52
|
+
rspec-expectations (2.13.0)
|
53
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
54
|
+
rspec-mocks (2.13.1)
|
55
|
+
sinatra (1.4.2)
|
56
|
+
rack (~> 1.5, >= 1.5.2)
|
57
|
+
rack-protection (~> 1.4)
|
58
|
+
tilt (~> 1.3, >= 1.3.4)
|
59
|
+
slop (3.4.5)
|
60
|
+
tilt (1.4.1)
|
61
|
+
tzinfo (0.3.37)
|
62
|
+
uuidtools (2.1.4)
|
63
|
+
yard (0.8.6.1)
|
69
64
|
|
70
65
|
PLATFORMS
|
71
66
|
ruby
|
@@ -74,7 +69,7 @@ DEPENDENCIES
|
|
74
69
|
activemodel
|
75
70
|
aws-sdk
|
76
71
|
bundler
|
77
|
-
fake_dynamo
|
72
|
+
fake_dynamo (~> 0.1.3)
|
78
73
|
github-markup
|
79
74
|
jeweler
|
80
75
|
mocha (= 0.10.0)
|
data/README.markdown
CHANGED
@@ -20,7 +20,7 @@ gem 'dynamoid'
|
|
20
20
|
## Prerequisities
|
21
21
|
|
22
22
|
Dynamoid depends on the aws-sdk, and this is tested on the current version of aws-sdk (1.6.9), rails 3.2.8.
|
23
|
-
Hence the configuration as needed for aws to work will be dealt with by aws setup.
|
23
|
+
Hence the configuration as needed for aws to work will be dealt with by aws setup.
|
24
24
|
|
25
25
|
Here are the steps to setup aws-sdk.
|
26
26
|
|
@@ -42,7 +42,7 @@ Fill in your AWS Access Key ID and Secret Access Key
|
|
42
42
|
development:
|
43
43
|
access_key_id: REPLACE_WITH_ACCESS_KEY_ID
|
44
44
|
secret_access_key: REPLACE_WITH_SECRET_ACCESS_KEY
|
45
|
-
|
45
|
+
dynamo_db_endpoint: dynamodb.ap-southeast-1.amazonaws.com
|
46
46
|
|
47
47
|
test:
|
48
48
|
<<: *development
|
@@ -60,21 +60,23 @@ Fill in your AWS Access Key ID and Secret Access Key
|
|
60
60
|
```ruby
|
61
61
|
|
62
62
|
#Additionally include any of the dynamodb paramters as needed.
|
63
|
-
#(eg: if you would like to change the dynamodb endpoint, then add the parameter in
|
64
|
-
# in the file aws.yml or aws.rb
|
65
|
-
|
66
|
-
dynamo_db_endpoint : dynamodb.ap-southeast-1.amazonaws.com)
|
63
|
+
#(eg: if you would like to change the dynamodb endpoint, then add the parameter in
|
64
|
+
# in the file aws.yml or aws.rb
|
67
65
|
|
68
66
|
AWS.config({
|
69
67
|
:access_key_id => 'REPLACE_WITH_ACCESS_KEY_ID',
|
70
68
|
:secret_access_key => 'REPLACE_WITH_SECRET_ACCESS_KEY',
|
71
|
-
:
|
69
|
+
:dynamo_db_endpoint => 'dynamodb.ap-southeast-1.amazonaws.com'
|
72
70
|
})
|
73
71
|
|
74
72
|
|
75
73
|
```
|
76
74
|
|
77
|
-
|
75
|
+
For a full list of the DDB regions, you can go
|
76
|
+
[here](http://docs.aws.amazon.com/general/latest/gr/rande.html#ddb_region).
|
77
|
+
|
78
|
+
|
79
|
+
Refer to the documentation of the AWS module at the below link for all of the configuration options supported by DynamoDB.
|
78
80
|
|
79
81
|
[Module AWS](http://docs.amazonwebservices.com/AWSRubySDK/latest/frames.html#!http%3A//docs.amazonwebservices.com/AWSRubySDK/latest/AWS.html)
|
80
82
|
|
@@ -102,7 +104,7 @@ You *must* include ```Dynamoid::Document``` in every Dynamoid model.
|
|
102
104
|
```ruby
|
103
105
|
class User
|
104
106
|
include Dynamoid::Document
|
105
|
-
|
107
|
+
|
106
108
|
end
|
107
109
|
```
|
108
110
|
|
@@ -113,7 +115,7 @@ Dynamoid has some sensible defaults for you when you create a new table, includi
|
|
113
115
|
```ruby
|
114
116
|
class User
|
115
117
|
include Dynamoid::Document
|
116
|
-
|
118
|
+
|
117
119
|
table :name => :awesome_users, :key => :user_id, :read_capacity => 400, :write_capacity => 400
|
118
120
|
end
|
119
121
|
```
|
@@ -124,7 +126,7 @@ These fields will not change an existing table: so specifying a new read_capacit
|
|
124
126
|
|
125
127
|
You'll have to define all the fields on the model and the data type of each field. Every field on the object must be included here; if you miss any they'll be completely bypassed during DynamoDB's initialization and will not appear on the model objects.
|
126
128
|
|
127
|
-
By default, fields are assumed to be of type ```:string```. But you can also use ```:integer```, ```:float```, ```:set```, ```:array```, ```:datetime```, and ```:serialized```. You get magic columns of id (string), created_at (datetime), and updated_at (datetime) for free.
|
129
|
+
By default, fields are assumed to be of type ```:string```. But you can also use ```:integer```, ```:float```, ```:set```, ```:array```, ```:datetime```, ```:boolean```, and ```:serialized```. You get magic columns of id (string), created_at (datetime), and updated_at (datetime) for free.
|
128
130
|
|
129
131
|
```ruby
|
130
132
|
class User
|
@@ -136,7 +138,7 @@ class User
|
|
136
138
|
field :number, :float
|
137
139
|
field :joined_at, :datetime
|
138
140
|
field :hash, :serialized
|
139
|
-
|
141
|
+
|
140
142
|
end
|
141
143
|
```
|
142
144
|
|
@@ -149,13 +151,13 @@ class User
|
|
149
151
|
include Dynamoid::Document
|
150
152
|
|
151
153
|
...
|
152
|
-
|
153
|
-
index :name
|
154
|
-
index :email
|
155
|
-
index [:name, :email]
|
154
|
+
|
155
|
+
index :name
|
156
|
+
index :email
|
157
|
+
index [:name, :email]
|
156
158
|
index :created_at, :range => true
|
157
159
|
index :name, :range_key => :joined_at
|
158
|
-
|
160
|
+
|
159
161
|
end
|
160
162
|
```
|
161
163
|
|
@@ -170,23 +172,23 @@ class User
|
|
170
172
|
include Dynamoid::Document
|
171
173
|
|
172
174
|
...
|
173
|
-
|
175
|
+
|
174
176
|
has_many :addresses
|
175
177
|
has_many :students, :class => User
|
176
178
|
belongs_to :teacher, :class_name => :user
|
177
179
|
belongs_to :group
|
178
180
|
has_one :role
|
179
181
|
has_and_belongs_to_many :friends, :inverse_of => :friending_users
|
180
|
-
|
182
|
+
|
181
183
|
end
|
182
184
|
|
183
185
|
class Address
|
184
186
|
include Dynamoid::Document
|
185
|
-
|
187
|
+
|
186
188
|
...
|
187
|
-
|
189
|
+
|
188
190
|
belongs_to :address # Automatically links up with the user model
|
189
|
-
|
191
|
+
|
190
192
|
end
|
191
193
|
```
|
192
194
|
|
@@ -201,7 +203,7 @@ class User
|
|
201
203
|
include Dynamoid::Document
|
202
204
|
|
203
205
|
...
|
204
|
-
|
206
|
+
|
205
207
|
validates_presence_of :name
|
206
208
|
validates_format_of :email, :with => /@/
|
207
209
|
end
|
@@ -218,7 +220,7 @@ class User
|
|
218
220
|
include Dynamoid::Document
|
219
221
|
|
220
222
|
...
|
221
|
-
|
223
|
+
|
222
224
|
before_save :set_default_password
|
223
225
|
after_create :notify_friends
|
224
226
|
after_destroy :delete_addresses
|
@@ -275,6 +277,14 @@ You can also limit returned results, or select a record from which to start, to
|
|
275
277
|
Address.limit(5).start(address) # Only 5 addresses.
|
276
278
|
```
|
277
279
|
|
280
|
+
For large queries that return many rows, Dynamoid can use AWS' support for requesting documents in batches:
|
281
|
+
|
282
|
+
```ruby
|
283
|
+
#Do some maintenance on the entire table without flooding DynamoDB
|
284
|
+
Address.all(batch_size: 100).each { |address| address.do_some_work; sleep(0.01) }
|
285
|
+
Address.limit(10_000).batch(100). each { … } #batch specified as part of a chain
|
286
|
+
```
|
287
|
+
|
278
288
|
### Consistent Reads
|
279
289
|
|
280
290
|
Querying supports consistent reading. By default, DynamoDB reads are eventually consistent: if you do a write and then a read immediately afterwards, the results of the previous write may not be reflected. If you need to do a consistent read (that is, you need to read the results of a write immediately) you can do so, but keep in mind that consistent reads are twice as expensive as regular reads for DynamoDB.
|
@@ -303,6 +313,24 @@ Dynamoid attempts to obviate this problem transparently by employing a partition
|
|
303
313
|
|
304
314
|
When your read or write throughput exceed your table's allowed provisioning, DynamoDB will wait on connections until throughput is available again. This will appear as very, very slow requests and can be somewhat frustrating. Partitioning significantly increases the amount of throughput tables will experience; though DynamoDB will ignore keys that don't exist, if you have 20 partitioned keys representing one object, all will be retrieved every time the object is requested. Ensure that your tables are set up for this kind of throughput, or turn provisioning off, to make sure that DynamoDB doesn't throttle your requests.
|
305
315
|
|
316
|
+
## Concurrency
|
317
|
+
|
318
|
+
Dynamoid supports basic, ActiveRecord-like optimistic locking on save operations. Simply add a `lock_version` column to your table like so:
|
319
|
+
|
320
|
+
```ruby
|
321
|
+
class MyTable
|
322
|
+
...
|
323
|
+
|
324
|
+
field :lock_version, :integer
|
325
|
+
|
326
|
+
...
|
327
|
+
end
|
328
|
+
```
|
329
|
+
|
330
|
+
In this example, all saves to `MyTable` will raise an `AWS::DynamoDB::Errors::ConditionalCheckFailedException` if a concurrent process loaded, edited, and saved the same row. Your code should trap this exception, reload the row (so that it will pick up the newest values), and try the save again.
|
331
|
+
|
332
|
+
Calls to `update` and `update!` also increment the `lock_version`, however they do not check the existing value. This guarantees that a update operation will raise an exception in a concurrent save operation, however a save operation will never cause an update to fail. Thus, `update` is useful & safe only for doing atomic operations (e.g. increment a value, add/remove from a set, etc), but should not be used in a read-modify-write pattern.
|
333
|
+
|
306
334
|
## Credits
|
307
335
|
|
308
336
|
Dynamoid borrows code, structure, and even its name very liberally from the truly amazing [Mongoid](https://github.com/mongoid/mongoid). Without Mongoid to crib from none of this would have been possible, and I hope they don't mind me reusing their very awesome ideas to make DynamoDB just as accessible to the Ruby world as MongoDB.
|
@@ -314,6 +342,8 @@ Also, without contributors the project wouldn't be nearly as awesome. So many th
|
|
314
342
|
* [Craig Heneveld](https://github.com/cheneveld)
|
315
343
|
* [Anantha Kumaran](https://github.com/ananthakumaran)
|
316
344
|
* [Jason Dew](https://github.com/jasondew)
|
345
|
+
* [Luis Arias](https://github.com/luisantonioa)
|
346
|
+
* [Stefan Neculai](https://github.com/stefanneculai)
|
317
347
|
|
318
348
|
## Running the tests
|
319
349
|
|
@@ -327,4 +357,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
327
357
|
|
328
358
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
329
359
|
|
330
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
360
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -36,6 +36,37 @@ RSpec::Core::RakeTask.new(:rcov) do |spec|
|
|
36
36
|
spec.rcov = true
|
37
37
|
end
|
38
38
|
|
39
|
+
desc "Start fake_dynamo, run tests, cleanup"
|
40
|
+
task :unattended_spec do |t|
|
41
|
+
require 'tmpdir'
|
42
|
+
require 'socket'
|
43
|
+
|
44
|
+
dir = Dir.mktmpdir
|
45
|
+
data_file = File.join(dir, "data.fdb")
|
46
|
+
|
47
|
+
#Launch fake_dynamo
|
48
|
+
pid = Process.spawn'fake_dynamo', '-d', data_file, err: '/dev/null', out: '/dev/null'
|
49
|
+
#Cleanup
|
50
|
+
at_exit {
|
51
|
+
Process.kill('TERM', pid)
|
52
|
+
FileUtils.rmtree(dir)
|
53
|
+
}
|
54
|
+
|
55
|
+
#Wait for fake_dynamo to start taking requests
|
56
|
+
40.downto(0) do |count| #Wait up to 2 seconds
|
57
|
+
begin
|
58
|
+
s = TCPSocket.new 'localhost', 4567
|
59
|
+
s.close
|
60
|
+
break
|
61
|
+
rescue Errno::ECONNREFUSED
|
62
|
+
raise if(count == 0)
|
63
|
+
sleep 0.1
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
Rake::Task["spec"].invoke
|
68
|
+
end
|
69
|
+
|
39
70
|
require 'yard'
|
40
71
|
YARD::Rake::YardocTask.new do |t|
|
41
72
|
t.files = ['lib/**/*.rb', "README", "LICENSE"] # optional
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.7.0
|
data/doc/Dynamoid.html
CHANGED
@@ -6,19 +6,21 @@
|
|
6
6
|
<title>
|
7
7
|
Module: Dynamoid
|
8
8
|
|
9
|
-
— Documentation by YARD 0.
|
9
|
+
— Documentation by YARD 0.8.6.1
|
10
10
|
|
11
11
|
</title>
|
12
12
|
|
13
|
-
<link rel="stylesheet" href="css/style.css" type="text/css"
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
14
|
|
15
|
-
<link rel="stylesheet" href="css/common.css" type="text/css"
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
16
|
|
17
17
|
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
18
19
|
relpath = '';
|
19
|
-
|
20
|
+
framesUrl = "frames.html#!" + escape(window.location.href);
|
20
21
|
</script>
|
21
22
|
|
23
|
+
|
22
24
|
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
23
25
|
|
24
26
|
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
@@ -26,36 +28,41 @@
|
|
26
28
|
|
27
29
|
</head>
|
28
30
|
<body>
|
29
|
-
<script type="text/javascript" charset="utf-8">
|
30
|
-
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
-
</script>
|
32
|
-
|
33
31
|
<div id="header">
|
34
32
|
<div id="menu">
|
35
33
|
|
36
|
-
<a href="_index.html">Index (D)</a> »
|
34
|
+
<a href="_index.html">Index (D)</a> »
|
37
35
|
|
38
36
|
|
39
37
|
<span class="title">Dynamoid</span>
|
40
38
|
|
41
|
-
|
39
|
+
|
42
40
|
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
41
|
</div>
|
44
42
|
|
45
43
|
<div id="search">
|
46
44
|
|
47
|
-
<a
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
48
49
|
|
49
|
-
<a
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
50
54
|
|
51
|
-
<a
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
52
59
|
|
53
60
|
</div>
|
54
61
|
<div class="clear"></div>
|
55
62
|
</div>
|
56
|
-
|
63
|
+
|
57
64
|
<iframe id="search_frame"></iframe>
|
58
|
-
|
65
|
+
|
59
66
|
<div id="content"><h1>Module: Dynamoid
|
60
67
|
|
61
68
|
|
@@ -81,7 +88,7 @@
|
|
81
88
|
|
82
89
|
<dt class="r1 last">Defined in:</dt>
|
83
90
|
<dd class="r1 last">lib/dynamoid/fields.rb<span class="defines">,<br />
|
84
|
-
lib/dynamoid.rb,<br /> lib/dynamoid/
|
91
|
+
lib/dynamoid.rb,<br /> lib/dynamoid/dirty.rb,<br /> lib/dynamoid/errors.rb,<br /> lib/dynamoid/config.rb,<br /> lib/dynamoid/indexes.rb,<br /> lib/dynamoid/adapter.rb,<br /> lib/dynamoid/finders.rb,<br /> lib/dynamoid/document.rb,<br /> lib/dynamoid/criteria.rb,<br /> lib/dynamoid/components.rb,<br /> lib/dynamoid/validations.rb,<br /> lib/dynamoid/persistence.rb,<br /> lib/dynamoid/identity_map.rb,<br /> lib/dynamoid/associations.rb,<br /> lib/dynamoid/indexes/index.rb,<br /> lib/dynamoid/config/options.rb,<br /> lib/dynamoid/criteria/chain.rb,<br /> lib/dynamoid/adapter/aws_sdk.rb,<br /> lib/dynamoid/associations/has_one.rb,<br /> lib/dynamoid/associations/has_many.rb,<br /> lib/dynamoid/associations/belongs_to.rb,<br /> lib/dynamoid/middleware/identity_map.rb,<br /> lib/dynamoid/associations/association.rb,<br /> lib/dynamoid/associations/many_association.rb,<br /> lib/dynamoid/associations/single_association.rb,<br /> lib/dynamoid/associations/has_and_belongs_to_many.rb</span>
|
85
92
|
</dd>
|
86
93
|
|
87
94
|
</dl>
|
@@ -99,11 +106,11 @@
|
|
99
106
|
|
100
107
|
</div><h2>Defined Under Namespace</h2>
|
101
108
|
<p class="children">
|
102
|
-
|
109
|
+
|
103
110
|
|
104
|
-
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Dynamoid/Adapter.html" title="Dynamoid::Adapter (module)">Adapter</a></span>, <span class='object_link'><a href="Dynamoid/Associations.html" title="Dynamoid::Associations (module)">Associations</a></span>, <span class='object_link'><a href="Dynamoid/Components.html" title="Dynamoid::Components (module)">Components</a></span>, <span class='object_link'><a href="Dynamoid/Config.html" title="Dynamoid::Config (module)">Config</a></span>, <span class='object_link'><a href="Dynamoid/Criteria.html" title="Dynamoid::Criteria (module)">Criteria</a></span>, <span class='object_link'><a href="Dynamoid/Document.html" title="Dynamoid::Document (module)">Document</a></span>, <span class='object_link'><a href="Dynamoid/Errors.html" title="Dynamoid::Errors (module)">Errors</a></span>, <span class='object_link'><a href="Dynamoid/Fields.html" title="Dynamoid::Fields (module)">Fields</a></span>, <span class='object_link'><a href="Dynamoid/Finders.html" title="Dynamoid::Finders (module)">Finders</a></span>, <span class='object_link'><a href="Dynamoid/Indexes.html" title="Dynamoid::Indexes (module)">Indexes</a></span>, <span class='object_link'><a href="Dynamoid/Persistence.html" title="Dynamoid::Persistence (module)">Persistence</a></span>, <span class='object_link'><a href="Dynamoid/Validations.html" title="Dynamoid::Validations (module)">Validations</a></span>
|
111
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Dynamoid/Adapter.html" title="Dynamoid::Adapter (module)">Adapter</a></span>, <span class='object_link'><a href="Dynamoid/Associations.html" title="Dynamoid::Associations (module)">Associations</a></span>, <span class='object_link'><a href="Dynamoid/Components.html" title="Dynamoid::Components (module)">Components</a></span>, <span class='object_link'><a href="Dynamoid/Config.html" title="Dynamoid::Config (module)">Config</a></span>, <span class='object_link'><a href="Dynamoid/Criteria.html" title="Dynamoid::Criteria (module)">Criteria</a></span>, <span class='object_link'><a href="Dynamoid/Dirty.html" title="Dynamoid::Dirty (module)">Dirty</a></span>, <span class='object_link'><a href="Dynamoid/Document.html" title="Dynamoid::Document (module)">Document</a></span>, <span class='object_link'><a href="Dynamoid/Errors.html" title="Dynamoid::Errors (module)">Errors</a></span>, <span class='object_link'><a href="Dynamoid/Fields.html" title="Dynamoid::Fields (module)">Fields</a></span>, <span class='object_link'><a href="Dynamoid/Finders.html" title="Dynamoid::Finders (module)">Finders</a></span>, <span class='object_link'><a href="Dynamoid/IdentityMap.html" title="Dynamoid::IdentityMap (module)">IdentityMap</a></span>, <span class='object_link'><a href="Dynamoid/Indexes.html" title="Dynamoid::Indexes (module)">Indexes</a></span>, <span class='object_link'><a href="Dynamoid/Middleware.html" title="Dynamoid::Middleware (module)">Middleware</a></span>, <span class='object_link'><a href="Dynamoid/Persistence.html" title="Dynamoid::Persistence (module)">Persistence</a></span>, <span class='object_link'><a href="Dynamoid/Validations.html" title="Dynamoid::Validations (module)">Validations</a></span>
|
105
112
|
|
106
|
-
|
113
|
+
|
107
114
|
|
108
115
|
|
109
116
|
</p>
|
@@ -150,6 +157,7 @@
|
|
150
157
|
|
151
158
|
|
152
159
|
|
160
|
+
|
153
161
|
|
154
162
|
|
155
163
|
<span class="summary_desc"><div class='inline'></div></span>
|
@@ -171,6 +179,7 @@
|
|
171
179
|
|
172
180
|
|
173
181
|
|
182
|
+
|
174
183
|
|
175
184
|
|
176
185
|
<span class="summary_desc"><div class='inline'></div></span>
|
@@ -192,6 +201,7 @@
|
|
192
201
|
|
193
202
|
|
194
203
|
|
204
|
+
|
195
205
|
|
196
206
|
|
197
207
|
<span class="summary_desc"><div class='inline'></div></span>
|
@@ -206,10 +216,10 @@
|
|
206
216
|
|
207
217
|
<div id="instance_method_details" class="method_details_list">
|
208
218
|
<h2>Instance Method Details</h2>
|
209
|
-
|
219
|
+
|
210
220
|
|
211
221
|
<div class="method_details first">
|
212
|
-
<
|
222
|
+
<h3 class="signature first" id="configure-instance_method">
|
213
223
|
|
214
224
|
- (<tt>Object</tt>) <strong>configure</strong>
|
215
225
|
|
@@ -219,19 +229,21 @@
|
|
219
229
|
<span class="names"><span id='config-instance_method'>config</span></span>
|
220
230
|
</span>
|
221
231
|
|
222
|
-
|
232
|
+
|
233
|
+
|
234
|
+
</h3><table class="source_code">
|
223
235
|
<tr>
|
224
236
|
<td>
|
225
237
|
<pre class="lines">
|
226
238
|
|
227
239
|
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
240
|
+
33
|
241
|
+
34
|
242
|
+
35
|
243
|
+
36</pre>
|
232
244
|
</td>
|
233
245
|
<td>
|
234
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid.rb', line
|
246
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid.rb', line 33</span>
|
235
247
|
|
236
248
|
<span class='kw'>def</span> <span class='id identifier rubyid_configure'>configure</span>
|
237
249
|
<span class='id identifier rubyid_block_given?'>block_given?</span> <span class='op'>?</span> <span class='kw'>yield</span><span class='lparen'>(</span><span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Config</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Config</span>
|
@@ -243,24 +255,26 @@
|
|
243
255
|
</div>
|
244
256
|
|
245
257
|
<div class="method_details ">
|
246
|
-
<
|
258
|
+
<h3 class="signature " id="included_models-instance_method">
|
247
259
|
|
248
260
|
- (<tt>Object</tt>) <strong>included_models</strong>
|
249
261
|
|
250
262
|
|
251
263
|
|
252
|
-
|
264
|
+
|
265
|
+
|
266
|
+
</h3><table class="source_code">
|
253
267
|
<tr>
|
254
268
|
<td>
|
255
269
|
<pre class="lines">
|
256
270
|
|
257
271
|
|
258
|
-
|
259
|
-
|
260
|
-
|
272
|
+
43
|
273
|
+
44
|
274
|
+
45</pre>
|
261
275
|
</td>
|
262
276
|
<td>
|
263
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid.rb', line
|
277
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid.rb', line 43</span>
|
264
278
|
|
265
279
|
<span class='kw'>def</span> <span class='id identifier rubyid_included_models'>included_models</span>
|
266
280
|
<span class='ivar'>@included_models</span> <span class='op'>||=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span>
|
@@ -271,24 +285,26 @@
|
|
271
285
|
</div>
|
272
286
|
|
273
287
|
<div class="method_details ">
|
274
|
-
<
|
288
|
+
<h3 class="signature " id="logger-instance_method">
|
275
289
|
|
276
290
|
- (<tt>Object</tt>) <strong>logger</strong>
|
277
291
|
|
278
292
|
|
279
293
|
|
280
|
-
|
294
|
+
|
295
|
+
|
296
|
+
</h3><table class="source_code">
|
281
297
|
<tr>
|
282
298
|
<td>
|
283
299
|
<pre class="lines">
|
284
300
|
|
285
301
|
|
286
|
-
|
287
|
-
|
288
|
-
|
302
|
+
39
|
303
|
+
40
|
304
|
+
41</pre>
|
289
305
|
</td>
|
290
306
|
<td>
|
291
|
-
<pre class="code"><span class="info file"># File 'lib/dynamoid.rb', line
|
307
|
+
<pre class="code"><span class="info file"># File 'lib/dynamoid.rb', line 39</span>
|
292
308
|
|
293
309
|
<span class='kw'>def</span> <span class='id identifier rubyid_logger'>logger</span>
|
294
310
|
<span class='const'>Dynamoid</span><span class='op'>::</span><span class='const'>Config</span><span class='period'>.</span><span class='id identifier rubyid_logger'>logger</span>
|
@@ -301,11 +317,11 @@
|
|
301
317
|
</div>
|
302
318
|
|
303
319
|
</div>
|
304
|
-
|
320
|
+
|
305
321
|
<div id="footer">
|
306
|
-
Generated on Thu
|
322
|
+
Generated on Thu Jun 27 21:59:09 2013 by
|
307
323
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
308
|
-
0.
|
324
|
+
0.8.6.1 (ruby-1.9.3).
|
309
325
|
</div>
|
310
326
|
|
311
327
|
</body>
|