ocean-rails 5.1.0 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7956549c44a22d159ec86fe06cc90be8bd71636
4
- data.tar.gz: 4ad871419b599e71c22ba893319068f5cbfa1fde
3
+ metadata.gz: d5c44b8c69112c22983de235e2f5132bd217ba76
4
+ data.tar.gz: bc171e271ad2b8e2a36edc9039d662da416d159c
5
5
  SHA512:
6
- metadata.gz: e72c5b332cff1f9e34fe22d815edd4cad90eb72243a4162dc055c66a461319df4fde5a7f9ddd4279e01a6eecdeaad731673acc30b764a4002bf00a7746464973
7
- data.tar.gz: 51b9c89cdb45a9cdbbac8fd6d405b6809cebcac887378ea40afc8aeccb0a4a4908b874af1669c668595d7498184c06a36194f4c71a143a714aae866d030df48b
6
+ metadata.gz: 64846dd878b0f1176007383dd028fac44570fa6c797e0e7f0519681709479c5e6f56127abdd6a2cef05e998e1836361fcaf13fcebda0b25c87e90bb190e8106c
7
+ data.tar.gz: faa9281445150744c0cf5d721d18def94e23e4c51d98f413df52bfeae67f2d9e8d21eebe71a99a89fbcb834f102609bc45c045b98859739d3b6e1925e94c79a0
data/README.rdoc CHANGED
@@ -74,40 +74,25 @@ You can now proceed to tailor the new resource to your needs. You will want to a
74
74
 
75
75
  === Running the specs
76
76
 
77
- To run the specs for the ocean-rails gem, you must first install the bundle. It will download
78
- a gem called +fake_dynamo+, which runs a local, in-memory functional clone of Amazon DynamoDB.
79
- We use +fake_dynamo+ during development and testing.
77
+ To run the specs for the +ocean-rails+ gem, you must first install DynamoDB Local.
78
+ It's a Java clone of Amazon DynamoDB which runs locally on your computer. We use
79
+ it for development and testing.
80
80
 
81
- First of all, copy the AWS configuration file from the template:
81
+ Download DynamoDB Local from the following location: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Tools.DynamoDBLocal.html
82
82
 
83
- cp spec/dummy/config/aws.yml.example spec/dummy/config/aws.yml
84
-
85
- NB: +aws.yml+ is excluded from source control. This allows you to enter your AWS credentials
86
- safely. Note that +aws.yml.example+ is under source control: don't edit it.
87
-
88
- Make sure your have version 0.1.3 of the +fake_dynamo+ gem. It implements the +2011-12-05+ version
89
- of the DynamoDB API. We're not yet using the +2012-08-10+ version, as the +aws-sdk+ ruby gem
90
- doesn't fully support it. We'll make the change as soon as +aws-sdk+ is updated. Reportedly,
91
- it's in the works.
92
-
93
- Next, start +fake_dynamo+:
83
+ Next, copy the AWS configuration file from the template:
94
84
 
95
- fake_dynamo --port 4567
96
-
97
- If this returns errors, make sure that <tt>/usr/local/var/fake_dynamo</tt> exists and
98
- is writable:
85
+ cp spec/dummy/config/aws.yml.example spec/dummy/config/aws.yml
99
86
 
100
- sudo mkdir -p /usr/local/var/fake_dynamo
101
- sudo chown peterb:staff /usr/local/var/fake_dynamo
87
+ NB: +aws.yml+ should be excluded from source control. This allows you to enter your AWS
88
+ credentials safely. On the other hand, +aws.yml.example+ SHOULD be under source control.
89
+ Don't put sensitive information in it.
102
90
 
103
- When +fake_dynamo+ runs normally, open another window and issue the following command:
91
+ You're now ready to start DynamoDB Local:
104
92
 
105
- curl -X DELETE http://localhost:4567
93
+ java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
106
94
 
107
- This will reset the +fake_dynamo+ database. It's not a required operation when starting
108
- +fake_dynamo+; we're just using it here as a test that the installation works. It will
109
- be issued automatically as part of the test suite, so don't expect test data to survive
110
- between runs.
95
+ Replace +-sharedDb+ with +-inMemory+ to run the DB in RAM.
111
96
 
112
97
  Next, copy the +config.yml+ file from its template:
113
98
 
@@ -120,13 +105,35 @@ You must now generate the SQLite databases:
120
105
  rake db:migrate
121
106
  RAILS_ENV=test rake db:migrate
122
107
 
123
- With +fake_dynamo+ running, you should now be able to do
108
+ With DynamoDB Local running, you should now be able to do
124
109
 
125
110
  rspec
126
111
 
127
112
  All tests should pass.
128
113
 
129
114
 
115
+ === Cleaning up the DB
116
+
117
+ You might want to add the following to your spec_helper.rb file, before the +RSpec.configure+
118
+ block:
119
+
120
+ # DynamoDB table cleaner
121
+ CHEF_ENV = "master" unless defined?(CHEF_ENV)
122
+ regexp = Regexp.new("^.+_#{CHEF_ENV}_[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}_test$")
123
+ cleaner = lambda {
124
+ c = Aws::DynamoDB::Client.new
125
+ c.list_tables.table_names.each { |t| c.delete_table({table_name: t}) if t =~ regexp }
126
+ }
127
+
128
+ Then, inside the +RSpec.configure+ block:
129
+
130
+ config.before(:suite) { cleaner.call }
131
+ config.after(:suite) { cleaner.call }
132
+
133
+ This will remove only those tables created by the specs on this particular machine and
134
+ environment. This is safe even on AWS and for parallel testing.
135
+
136
+
130
137
  === Rails console
131
138
 
132
139
  The Rails console is available from the built-in dummy application:
@@ -2,8 +2,7 @@
2
2
  if (ENV['AWS_ACCESS_KEY_ID'].present? &&
3
3
  ENV['AWS_SECRET_ACCESS_KEY'].present? &&
4
4
  ENV['AWS_REGION'].present?)
5
- #AWS.config if defined? AWS
6
- #Aws.config if defined? Aws
5
+ Aws.config if defined? Aws
7
6
  else
8
7
 
9
8
  # The is the example file
@@ -27,8 +26,12 @@ else
27
26
  ENV['AWS_ACCESS_KEY_ID'] = options[:access_key_id] || options['access_key_id']
28
27
  ENV['AWS_SECRET_ACCESS_KEY'] = options[:secret_access_key] || options['secret_access_key']
29
28
  ENV['AWS_REGION'] = options[:region] || options['region']
30
- #AWS.config options if defined? AWS
31
- #Aws.config = options if defined? Aws
29
+ Aws.config.update(
30
+ region: options["region"],
31
+ credentials: Aws::Credentials.new(options["access_key_id"], options["secret_access_key"]),
32
+ endpoint: options["endpoint"]
33
+ )
34
+
32
35
  else
33
36
  # Otherwise print an error message and abort.
34
37
  puts
data/lib/ocean/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ocean
2
- VERSION = "5.1.0"
2
+ VERSION = "5.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson