ocean-rails 7.0.2 → 7.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/initializers/_ocean_constants.rb +4 -11
- data/lib/generators/ocean_setup/templates/aws.yml.example +2 -3
- data/lib/generators/ocean_setup/templates/config.yml.example +5 -7
- data/lib/generators/ocean_setup/templates/spec_helper.rb +2 -2
- data/lib/ocean/api.rb +10 -10
- data/lib/ocean/api_resource.rb +3 -3
- data/lib/ocean/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: 55ee0d2e59d628299a0b7c3d1b5736d20a2c7378
|
4
|
+
data.tar.gz: 1954c7bbf968b5cfc53a66acb9763a840853107e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78b5ccb8d16d7451f3499d475ed2171efbc13251e32f1b1b07dc226fd800aaf80842bfa77d4b0c57f742c2aa99fff167421a69e75c897a5c6ee9a50df77f1553
|
7
|
+
data.tar.gz: 33ca5a629222de0b358e924caec26ffe26a3f179d982a2f43e3345c6e139ef75b94bfea6a826e37a8e0905af5562c1fcc7d7df897c699791238cdee864df4678
|
@@ -14,25 +14,18 @@
|
|
14
14
|
# make calls to partners' systems, such as for hotel bookings).
|
15
15
|
#
|
16
16
|
# Thus, if you are a frontend developer, you override the string
|
17
|
-
# constant here to reflect the
|
17
|
+
# constant here to reflect the Ocean environment (dev, staging)
|
18
18
|
# you wish to run your local tests against by defining the environment
|
19
19
|
# variable OCEAN_API_HOST.
|
20
20
|
#
|
21
|
-
# When TeamCity runs its tests, it will set these constants to values
|
22
|
-
# appropriate for the Chef environment for which the tests are run.
|
23
|
-
# Thus, TeamCity will always run master branch frontend tests against
|
24
|
-
# the master Chef environment. However, you can run a personal build
|
25
|
-
# and specify the OCEAN_API_HOST value as an environment param in the
|
26
|
-
# build dialog.
|
27
|
-
#
|
28
21
|
|
29
22
|
BASE_DOMAIN = "example.com" unless defined?(BASE_DOMAIN) # For the Rails template generator
|
30
23
|
|
31
24
|
OCEAN_API_HOST = (ENV['OCEAN_API_HOST'] ||
|
32
25
|
(Rails.env == 'test' && "forbidden.#{BASE_DOMAIN}") ||
|
33
|
-
"
|
34
|
-
).sub("<default>", "
|
26
|
+
"dev-api.#{BASE_DOMAIN}"
|
27
|
+
).sub("<default>", "dev")
|
35
28
|
|
36
29
|
OCEAN_API_URL = "https://#{OCEAN_API_HOST}"
|
37
30
|
|
38
|
-
INTERNAL_OCEAN_API_URL = OCEAN_API_URL.sub("https", "http")
|
31
|
+
INTERNAL_OCEAN_API_URL = OCEAN_API_URL.sub("https://", "http://")
|
@@ -7,8 +7,7 @@
|
|
7
7
|
# If your application doesn't use any AWS functionality, you should delete both
|
8
8
|
# aws.yml.example and aws.yml. In that case, none of them may exist in your application.
|
9
9
|
#
|
10
|
-
# NB: the
|
11
|
-
# staging, prod) will replace the contents of config/aws.yml with an auto-generated file.
|
10
|
+
# NB: On AWS, the contents of this file will be replaced by an auto-generated file.
|
12
11
|
##########################################################################################
|
13
12
|
|
14
13
|
|
@@ -27,7 +26,7 @@ amazon: &amazon
|
|
27
26
|
#
|
28
27
|
# It is safe to set any of the following three environments to
|
29
28
|
# *amazon, as table names will be suffixed according to the
|
30
|
-
# environment (
|
29
|
+
# environment (OCEAN_ENV and Rails.env). See Api.basename_suffix.
|
31
30
|
# You can use *amazon instead of *local if you wish.
|
32
31
|
#
|
33
32
|
|
@@ -2,17 +2,15 @@
|
|
2
2
|
# In order for the application to work, a file named config/config.yml must exist.
|
3
3
|
# You can use this file as a template: simply copy it, rename it and tailor its
|
4
4
|
# contents. All data in this file will be used to define constants in your application
|
5
|
-
# namespace. Please note that both config.yml and config.yml.example must exist
|
6
|
-
# delete this example file, as its values will be used by TeamCity for tests.
|
5
|
+
# namespace. Please note that both config.yml and config.yml.example must exist.
|
7
6
|
#
|
8
7
|
# Any constants declared here can be overridden by corresponding environment variables
|
9
8
|
# starting with OVERRIDE_. Thus, BASE_DOMAIN can be overridden by the environment
|
10
9
|
# variable OVERRIDE_BASE_DOMAIN, and so forth. The API_PASSWORD receives special
|
11
10
|
# treatment: you can pass both the master and the staging password separated by a comma,
|
12
|
-
# and Ocean will choose the appropriate one to use depending on the
|
11
|
+
# and Ocean will choose the appropriate one to use depending on the Ocean environment.
|
13
12
|
#
|
14
|
-
# NB:
|
15
|
-
# replace the contents of config/config.yml with an auto-generated file.
|
13
|
+
# NB: The contents of this file will be replaced by an auto-generated file on AWS.
|
16
14
|
##########################################################################################
|
17
15
|
|
18
16
|
|
@@ -40,8 +38,8 @@ LOAD_BALANCERS: []
|
|
40
38
|
# This is the list of IP numbers for the ZeroMQ log hosts. (Only used in production.)
|
41
39
|
LOG_HOSTS: []
|
42
40
|
|
43
|
-
# The
|
44
|
-
|
41
|
+
# The Ocean environment
|
42
|
+
OCEAN_ENV: master
|
45
43
|
|
46
44
|
|
47
45
|
##########################################################################################
|
@@ -14,8 +14,8 @@ require 'rspec/rails'
|
|
14
14
|
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
|
15
15
|
|
16
16
|
# DynamoDB table cleaner
|
17
|
-
|
18
|
-
regexp = Regexp.new("^.+_#{
|
17
|
+
OCEAN_ENV = "dev" unless defined?(OCEAN_ENV)
|
18
|
+
regexp = Regexp.new("^.+_#{OCEAN_ENV}_[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}-[0-9]{1,3}_(test|dev)$")
|
19
19
|
cleaner = lambda {
|
20
20
|
c = Aws::DynamoDB::Client.new
|
21
21
|
c.list_tables.table_names.each do |t|
|
data/lib/ocean/api.rb
CHANGED
@@ -10,7 +10,7 @@ class Api
|
|
10
10
|
# in master and staging, as the https URIs aren't available for CronJobs,
|
11
11
|
# etc.
|
12
12
|
#
|
13
|
-
def self.internalize_uri(uri,
|
13
|
+
def self.internalize_uri(uri, ocean_env=OCEAN_ENV)
|
14
14
|
uri.sub(OCEAN_API_URL, INTERNAL_OCEAN_API_URL)
|
15
15
|
end
|
16
16
|
|
@@ -26,12 +26,12 @@ class Api
|
|
26
26
|
|
27
27
|
#
|
28
28
|
# Adds environment info to the basename, so that testing and execution in various combinations
|
29
|
-
# of the Rails env and the
|
29
|
+
# of the Rails env and the Ocean environment can be done without collision.
|
30
30
|
#
|
31
|
-
# The
|
32
|
-
# between different
|
31
|
+
# The ocean_env will always be appended to the basename, since we never want to share queues
|
32
|
+
# between different Ocean environments.
|
33
33
|
#
|
34
|
-
# If the
|
34
|
+
# If the ocean_env is 'dev' or 'ci', we must separate things as much as
|
35
35
|
# possible: therefore, we add the local IP number and the Rails environment.
|
36
36
|
#
|
37
37
|
# We also add the same information if by any chance the Rails environment isn't 'production'.
|
@@ -40,10 +40,10 @@ class Api
|
|
40
40
|
#
|
41
41
|
# If +suffix_only+ is true, the basename will be excluded from the returned string.
|
42
42
|
#
|
43
|
-
def self.adorn_basename(basename,
|
43
|
+
def self.adorn_basename(basename, ocean_env: "dev", rails_env: "development",
|
44
44
|
suffix_only: false)
|
45
|
-
fullname = suffix_only ? "_#{
|
46
|
-
if rails_env != 'production' ||
|
45
|
+
fullname = suffix_only ? "_#{ocean_env}" : "#{basename}_#{ocean_env}"
|
46
|
+
if rails_env != 'production' || ocean_env == 'dev' || ocean_env == 'ci'
|
47
47
|
local_ip = UDPSocket.open {|s| s.connect("64.233.187.99", 1); s.addr.last}.gsub('.', '-')
|
48
48
|
fullname += "_#{local_ip}_#{rails_env}"
|
49
49
|
end
|
@@ -52,10 +52,10 @@ class Api
|
|
52
52
|
|
53
53
|
|
54
54
|
#
|
55
|
-
# Like +adorn_basename+, but returns only the suffix. Uses
|
55
|
+
# Like +adorn_basename+, but returns only the suffix. Uses OCEAN_ENV and Rails.env.
|
56
56
|
#
|
57
57
|
def self.basename_suffix
|
58
|
-
adorn_basename '', suffix_only: true,
|
58
|
+
adorn_basename '', suffix_only: true, ocean_env: OCEAN_ENV, rails_env: Rails.env
|
59
59
|
end
|
60
60
|
|
61
61
|
|
data/lib/ocean/api_resource.rb
CHANGED
@@ -120,8 +120,8 @@ module ApiResource
|
|
120
120
|
end
|
121
121
|
|
122
122
|
#
|
123
|
-
# Invalidate all members of this class in Varnish using a +BAN+ requests to
|
124
|
-
# caches in the
|
123
|
+
# Invalidate all members of this class in Varnish using a +BAN+ requests to the
|
124
|
+
# caches in the Ocean environment. The +BAN+ requests are done in parallel.
|
125
125
|
# The number of +BAN+ requests, and the exact +URI+ composition in each request,
|
126
126
|
# is determined by the +invalidate_collection:+ arg to the +ocean_resource_model+
|
127
127
|
# declaration in the model.
|
@@ -151,7 +151,7 @@ module ApiResource
|
|
151
151
|
|
152
152
|
#
|
153
153
|
# Invalidate the member and all its collections in Varnish using a +BAN+ requests to all
|
154
|
-
# caches in the
|
154
|
+
# caches in the Ocean environment. The +BAN+ request are done in parallel.
|
155
155
|
# The number of +BAN+ requests, and the exact +URI+ composition in each request,
|
156
156
|
# is determined by the +invalidate_member:+ arg to the +ocean_resource_model+
|
157
157
|
# declaration in the model.
|
data/lib/ocean/version.rb
CHANGED
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: 7.0.
|
4
|
+
version: 7.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: 2017-04-
|
11
|
+
date: 2017-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|