ocean-rails 1.19.0 → 1.20.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: 7b07c48320b0fb3b254c5fb015b1dbc170459c61
4
- data.tar.gz: 9523c8b17736174826d5a6e56c5b9fa27ef8f76e
3
+ metadata.gz: 50269a89296e4a7050a83b8974d2d6548124d29e
4
+ data.tar.gz: 3d2c4ae053e1f1d005025c7fd8c35bcf63165ebb
5
5
  SHA512:
6
- metadata.gz: dd8728127e2c3ab22ed3ef365b4773a70a8cba8a50847f4b67de195dea89dff948bc471f183627f89f320bca4ed1b8de832a3f4ab382dddf986c2bf2cb210a18
7
- data.tar.gz: a707f37e89bf9a56e1efba51b8a50cf33af207026daf4d254906cf9b9dd476f1ac1b33595156c3b1dd052d3f445cb72e90e4418ef8be2f66759d051dc48eee8d
6
+ metadata.gz: 460830b63eed3b25ba396d957fe9355ae61766bae29843a5f54d9ea092d8e8c434235780d53d8ed486cb7f83645a55b6b133e7227e7b94d09b2c4df287177a4b
7
+ data.tar.gz: 8dc3b4d2e2fb6a6c3d183e9283829ee45c6c15bf5e10b1d40d229036c57f65b2174b6255f45736b18328bf127899a55880d70b95c0f3a1f2fd5356a2a0b25bdb
data/README.rdoc CHANGED
@@ -72,3 +72,87 @@ All tests should pass. The test coverage should be very close to 100%. A Factory
72
72
  You can now proceed to tailor the new resource to your needs. You will want to add other attributes to the model or remove some or all of the default ones; you can change the JSON representation by modifying the view; and you might want to add or remove controller actions, e.g. to support secondary collections and relations to other resources. And as you no doubt are a responsible, informed developer, you will of course do all this using TDD and/or BDD techniques.
73
73
 
74
74
 
75
+ === Running the specs
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.
80
+
81
+ First of all, copy the AWS configuration file from the template:
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+:
94
+
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:
99
+
100
+ sudo mkdir -p /usr/local/var/fake_dynamo
101
+ sudo chown peterb:staff /usr/local/var/fake_dynamo
102
+
103
+ When +fake_dynamo+ runs normally, open another window and issue the following command:
104
+
105
+ curl -X DELETE http://localhost:4567
106
+
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.
111
+
112
+ Next, copy the +config.yml+ file from its template:
113
+
114
+ cp spec/dummy/config/config.yml.example spec/dummy/config/config.yml
115
+
116
+ Edit the contents of +config.yml+ to suit your setup.
117
+
118
+ You must now generate the SQLite databases:
119
+
120
+ rake db:migrate
121
+ RAILS_ENV=test rake db:migrate
122
+
123
+ With +fake_dynamo+ running, you should now be able to do
124
+
125
+ rspec
126
+
127
+ All tests should pass.
128
+
129
+
130
+ === Rails console
131
+
132
+ The Rails console is available from the built-in dummy application:
133
+
134
+ cd spec/dummy
135
+ rails console
136
+
137
+ You're now in a sandbox environment (thanks to +webmock+): HTTP accesses are disallowed;
138
+ each HTTP access you make will be intercepted with a message describing exactly how to
139
+ mock it away.
140
+
141
+ To enable HTTP traffic:
142
+
143
+ WebMock.allow_net_connect!
144
+
145
+ Please refer to the +webmock+ gem documentation for full information. It's possible to
146
+ prevent traffic only to specific hosts (e.g. +localhost+).
147
+
148
+ You may also need to initialise the table connection:
149
+
150
+ CloudModel.establish_db_connection
151
+
152
+ This will, amongst other things, also create the CloudModel table if it doesn't already
153
+ exist. On Amazon, this will take a little while. With +fake_dynamo+, it's practically
154
+ instant.
155
+
156
+ When you leave the console, you must navigate back to the Rails directory (<tt>cd ../..</tt>)
157
+ in order to be able to run RSpec again.
158
+
@@ -33,5 +33,8 @@
33
33
  # Ignore the tailored config.yml file
34
34
  config/config.yml
35
35
 
36
+ # Ignore any tailored aws.yml file
37
+ config/aws.yml
38
+
36
39
  # Ignore the Tork config dir
37
40
  /.tork
data/lib/ocean-rails.rb CHANGED
@@ -10,6 +10,7 @@ require "ocean/zeromq_logger"
10
10
  require "ocean/selective_rack_logger"
11
11
  require "ocean/flooding"
12
12
 
13
+
13
14
  INVALIDATE_MEMBER_DEFAULT = ["($|/|\\?)"]
14
15
  INVALIDATE_COLLECTION_DEFAULT = ["($|\\?)"]
15
16
 
data/lib/ocean/api.rb CHANGED
@@ -62,8 +62,11 @@ class Api
62
62
  # This is a precaution; in staging and prod apps should always run in Rails production mode,
63
63
  # but if by mistake they don't, we must prevent the production queues from being touched.
64
64
  #
65
- def self.adorn_basename(basename, chef_env: "dev", rails_env: "development")
66
- fullname = "#{basename}_#{chef_env}"
65
+ # If +suffix_only+ is true, the basename will be excluded from the returned string.
66
+ #
67
+ def self.adorn_basename(basename, chef_env: "dev", rails_env: "development",
68
+ suffix_only: false)
69
+ fullname = suffix_only ? "_#{chef_env}" : "#{basename}_#{chef_env}"
67
70
  if rails_env != 'production' || chef_env == 'dev' || chef_env == 'ci'
68
71
  local_ip = UDPSocket.open {|s| s.connect("64.233.187.99", 1); s.addr.last}.gsub('.', '-')
69
72
  fullname += "_#{local_ip}_#{rails_env}"
@@ -72,6 +75,14 @@ class Api
72
75
  end
73
76
 
74
77
 
78
+ #
79
+ # Like +adorn_basename+, but returns only the suffix. Uses CHEF_ENV and Rails.env.
80
+ #
81
+ def self.basename_suffix
82
+ adorn_basename '', suffix_only: true, chef_env: CHEF_ENV, rails_env: Rails.env
83
+ end
84
+
85
+
75
86
  #
76
87
  # Makes a HTTP request to +host_url+ using the HTTP method +method+. The +resource_name+
77
88
  # is used to obtain the latest version string of the resource. The arg +path+ is the
data/lib/ocean/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ocean
2
- VERSION = "1.19.0"
2
+ VERSION = "1.20.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocean-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.19.0
4
+ version: 1.20.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Bengtson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-02 00:00:00.000000000 Z
11
+ date: 2013-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: ocean-dynamo
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :runtime
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: rails
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -192,6 +206,20 @@ dependencies:
192
206
  - - ~>
193
207
  - !ruby/object:Gem::Version
194
208
  version: '4.0'
209
+ - !ruby/object:Gem::Dependency
210
+ name: fake_dynamo
211
+ requirement: !ruby/object:Gem::Requirement
212
+ requirements:
213
+ - - ~>
214
+ - !ruby/object:Gem::Version
215
+ version: 0.1.3
216
+ type: :development
217
+ prerelease: false
218
+ version_requirements: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ~>
221
+ - !ruby/object:Gem::Version
222
+ version: 0.1.3
195
223
  description: "== Ocean\n\nOcean is an architecture for creating server-oriented architectures
196
224
  (SOAs) in the cloud. \nIt consists of two separate parts which can be used separately
197
225
  or in conjunction: Ocean and OceanFront.\n\nOcean is a complete and very scalable