jets 1.0.15 → 1.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/jets/application.rb +27 -17
- data/lib/jets/aws_info.rb +9 -2
- data/lib/jets/commands/deploy.rb +4 -2
- data/lib/jets/core.rb +1 -1
- data/lib/jets/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 705c645de879c7e521d0dcb66b90b37e4360c67510ab8ffb8ad16e8755093704
|
4
|
+
data.tar.gz: 3a50bef872e5c8851d95fc4ece586ab3b3b006bfaafc752e959d01a58d32674f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34a5e03a72d87f5cab1a02a555e5c9c30c026cc535c1bb4a1c609171201e1c9c9ff8f07f460ef90431a47fd2ed6afac4de9f663fb06ee16747ad1b10f0722b91
|
7
|
+
data.tar.gz: 412567cb2846d8d9e0c00c4e9ea8a7e87c775b6ad2220f3e0d0c7d0723a4203bc7730afef6a67a1474caaa0d66a4d7d47af15f7caad2fd1aecac0adf48a36f5a
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [1.0.16]
|
7
|
+
- fix application iam policy when Jets::Application.default_iam_policy is used in config/application.rb
|
8
|
+
- #69 from tongueroo/fix-app-iam-policy
|
9
|
+
|
6
10
|
## [1.0.15]
|
7
11
|
- Fix polymorphic support: #67 from tongueroo/poly-fixes
|
8
12
|
- update .env.development example
|
data/Gemfile.lock
CHANGED
data/lib/jets/application.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require "active_support/ordered_options"
|
2
|
+
require "singleton"
|
2
3
|
|
3
4
|
class Jets::Application
|
5
|
+
include Singleton
|
4
6
|
extend Memoist
|
5
7
|
# Middleware used for development only
|
6
8
|
autoload :Middleware, "jets/application/middleware"
|
@@ -73,17 +75,31 @@ class Jets::Application
|
|
73
75
|
|
74
76
|
def load_configs
|
75
77
|
# The Jets default/application.rb is loaded.
|
76
|
-
|
78
|
+
load File.expand_path("../default/application.rb", __FILE__)
|
77
79
|
# Then project config/application.rb is loaded.
|
78
|
-
|
79
|
-
require app_config if File.exist?(app_config)
|
80
|
-
# Normalize config and setup some shortcuts
|
81
|
-
set_aliases!
|
82
|
-
normalize_env_vars!
|
80
|
+
load_app_config
|
83
81
|
load_db_config
|
84
82
|
load_environments_config
|
85
83
|
end
|
86
84
|
|
85
|
+
# First time loading this might not have all the values. Some values like
|
86
|
+
# project_namespace depend on project_name. Loading the config twice
|
87
|
+
# resolves the chicken and egg problem here.
|
88
|
+
def load_app_config
|
89
|
+
eval_app_config
|
90
|
+
# Normalize config and setup some shortcuts
|
91
|
+
set_dependent_configs! # things like project_namespace that need project_name
|
92
|
+
eval_app_config # twice to fix values that rely on the dependent configs
|
93
|
+
|
94
|
+
set_iam_policy # relies on dependent values, must be called late
|
95
|
+
normalize_env_vars!
|
96
|
+
end
|
97
|
+
|
98
|
+
def eval_app_config
|
99
|
+
app_config = "#{Jets.root}config/application.rb"
|
100
|
+
load app_config if File.exist?(app_config)
|
101
|
+
end
|
102
|
+
|
87
103
|
def load_environments_config
|
88
104
|
env_file = "#{Jets.root}config/environments/#{Jets.env}.rb"
|
89
105
|
if File.exist?(env_file)
|
@@ -104,7 +120,7 @@ class Jets::Application
|
|
104
120
|
production: 'prod',
|
105
121
|
staging: 'stag',
|
106
122
|
}
|
107
|
-
def
|
123
|
+
def set_dependent_configs!
|
108
124
|
# env_extra can be also be set with JETS_ENV_EXTRA.
|
109
125
|
# JETS_ENV_EXTRA higher precedence than config.env_extra
|
110
126
|
config.env_extra = ENV['JETS_ENV_EXTRA'] if ENV['JETS_ENV_EXTRA']
|
@@ -115,10 +131,6 @@ class Jets::Application
|
|
115
131
|
config.table_namespace = [config.project_name, config.short_env].compact.join('-')
|
116
132
|
|
117
133
|
config.project_namespace = Jets.project_namespace
|
118
|
-
|
119
|
-
# Must set default iam_policy here instead of `def config` because we project_namespace
|
120
|
-
# must have been set and if we call it from `def config` we get an infinite loop
|
121
|
-
set_iam_policy
|
122
134
|
end
|
123
135
|
|
124
136
|
def set_iam_policy
|
@@ -127,12 +139,10 @@ class Jets::Application
|
|
127
139
|
end
|
128
140
|
|
129
141
|
# After the mimimal template gets build, we need to reload it for the full stack
|
130
|
-
# creation. This
|
131
|
-
#
|
132
|
-
def
|
133
|
-
|
134
|
-
config.managed_policy_definitions = nil
|
135
|
-
set_iam_policy
|
142
|
+
# creation. This allows us to reference IAM policies configs that depend on the
|
143
|
+
# creation of the s3 bucket.
|
144
|
+
def reload_configs!
|
145
|
+
load_configs
|
136
146
|
end
|
137
147
|
|
138
148
|
def self.default_iam_policy
|
data/lib/jets/aws_info.rb
CHANGED
@@ -73,8 +73,15 @@ module Jets
|
|
73
73
|
stack = resp.stacks.first
|
74
74
|
output = stack["outputs"].find { |o| o["output_key"] == "S3Bucket" }
|
75
75
|
@@s3_bucket = output["output_value"] # s3_bucket
|
76
|
-
rescue
|
77
|
-
#
|
76
|
+
rescue Exception => e
|
77
|
+
# When user uses Jets::Application.default_iam_policy in their config/application.rb
|
78
|
+
# it looks up the s3 bucket for the iam policy, but the project name has
|
79
|
+
# not been loaded in the config yet. We do some trickery with loading
|
80
|
+
# the config twice in Application#load_app_config
|
81
|
+
# The first load will result in a Aws::CloudFormation::Errors::ValidationError
|
82
|
+
# since the Jets::Naming.parent_stack_name has not been properly set yet.
|
83
|
+
#
|
84
|
+
# Rescuing all exceptions in case there are other exceptions dont know about yet
|
78
85
|
# Here are the known ones: Aws::CloudFormation::Errors::ValidationError, Aws::CloudFormation::Errors::InvalidClientTokenId
|
79
86
|
BUCKET_DOES_NOT_YET_EXIST
|
80
87
|
end
|
data/lib/jets/commands/deploy.rb
CHANGED
@@ -19,9 +19,11 @@ module Jets::Commands
|
|
19
19
|
# Delete existing rollback stack from previous bad minimal deploy
|
20
20
|
delete_minimal_stack if minimal_rollback_complete?
|
21
21
|
exit_unless_updateable! # Stack could be in a weird rollback state or in progress state
|
22
|
-
ship(stack_type: :minimal) if first_run?
|
23
22
|
|
24
|
-
|
23
|
+
if first_run?
|
24
|
+
ship(stack_type: :minimal)
|
25
|
+
Jets.application.reload_configs!
|
26
|
+
end
|
25
27
|
|
26
28
|
# Build code after the minimal stack because need s3 bucket for assets
|
27
29
|
# on_aws? and s3_base_url logic
|
data/lib/jets/core.rb
CHANGED
data/lib/jets/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-11-
|
11
|
+
date: 2018-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|