ocean-dynamo 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +18 -15
- data/lib/ocean-dynamo/version.rb +1 -1
- 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: f2cdd30b503b4060f584c550f20b4bfa7b2ba959
|
4
|
+
data.tar.gz: 5048098e3a9566858ce71b3862c3af4f822ef765
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2600759e665f052392e3255ff0a382ee6175d25d393ff64a550b96ae2f49841abf87a35f56cf3ac174765cd3bf9fd71b83d11e8c1527c09fc611c85d177446d9
|
7
|
+
data.tar.gz: 0f7242ea5d99b228600f79e2cc7f83c47bca269c6c605794a09d87a8beeacc6d0fc8c25ce40ee4df976b191a3e418cbcfc42e99b26d61753953b3cc6edfd2f31
|
data/README.rdoc
CHANGED
@@ -37,7 +37,7 @@ The following example shows the basic syntax for declaring a DynamoDB-based sche
|
|
37
37
|
|
38
38
|
dynamo_schema(:guid) do
|
39
39
|
attribute :credentials, :string
|
40
|
-
attribute :token, :string, default: Proc { SecureRandom.
|
40
|
+
attribute :token, :string, default: Proc { SecureRandom.uuid }
|
41
41
|
attribute :steps, :serialized, default: []
|
42
42
|
attribute :max_seconds_in_queue, :integer, default: 1.day
|
43
43
|
attribute :default_poison_limit, :integer, default: 5
|
@@ -269,26 +269,29 @@ With DynamoDB Local running, you should now be able to do
|
|
269
269
|
All tests should pass.
|
270
270
|
|
271
271
|
|
272
|
-
===
|
272
|
+
=== Cleaning up the DB
|
273
273
|
|
274
|
-
You might want to add the following to your spec_helper.rb file,
|
275
|
-
block
|
274
|
+
You might want to add the following to your spec_helper.rb file, before the +RSpec.configure+
|
275
|
+
block:
|
276
276
|
|
277
|
-
|
277
|
+
# DynamoDB table cleaner
|
278
|
+
CHEF_ENV = "master" unless defined?(CHEF_ENV)
|
279
|
+
cleaner = lambda {
|
278
280
|
c = Aws::DynamoDB::Client.new
|
279
|
-
|
280
|
-
|
281
|
-
next unless t =~ regexp
|
281
|
+
c.list_tables.table_names.each do |t|
|
282
|
+
next unless t =~ Regexp.new("^.+_#{CHEF_ENV}_[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}_test$")
|
282
283
|
c.delete_table({table_name: t})
|
283
284
|
end
|
284
|
-
|
285
|
+
}
|
286
|
+
|
287
|
+
Then, inside the +RSpec.configure+ block:
|
288
|
+
|
289
|
+
config.before(:suite) { cleaner.call }
|
290
|
+
config.after(:suite) { cleaner.call }
|
291
|
+
|
292
|
+
This will remove only those tables created by the specs on this particular machine and
|
293
|
+
environment. This is safe even on AWS and for parallel testing.
|
285
294
|
|
286
|
-
You can add an +after(:suite)+ block too if you like, to remove all test tables after
|
287
|
-
the suite has run. Later, we will add automatic removal of only those tables created
|
288
|
-
by the test run itself, which is required when tests are done in parallel against
|
289
|
-
the real AWS service. Until then, you might want to modify the above code to do nothing
|
290
|
-
when running against AWS and clear your test tables manually. (If you're running Ocean,
|
291
|
-
an Ocean CronJob will already take care of this for you each night.)
|
292
295
|
|
293
296
|
== Rails console
|
294
297
|
|
data/lib/ocean-dynamo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ocean-dynamo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Bengtson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|