jets 1.5.10 → 1.6.0
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 +5 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/lib/jets/commands/upgrade.rb +1 -0
- data/lib/jets/resource/api_gateway/rest_api/routes/change/base.rb +33 -3
- data/lib/jets/resource/api_gateway/rest_api/routes/collision.rb +2 -0
- data/lib/jets/resource/iam/application_role.rb +2 -2
- data/lib/jets/resource/iam/base_role_definition.rb +3 -2
- data/lib/jets/resource/iam/class_role.rb +2 -2
- data/lib/jets/resource/iam/function_role.rb +2 -2
- data/lib/jets/resource/lambda/function.rb +17 -2
- 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: 525a55f0013d6870b5bd4a0fa2f63b981c8af0f82e1fbf6b2cabc847a9e6cb76
|
4
|
+
data.tar.gz: 17171ba50a0c0e422d7d128465c21c529b13ddfbe7513a7d752f20112a5f81b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea140c8868652da36b15d10da8a681792d6623cfb76e8480841900e76a2ea7ce9fd0a7fbe30c570d0d51b7d514bc8d0c6a5d8f3259a9f97ff7df6ee85b484df9
|
7
|
+
data.tar.gz: cc4b2ac99cbb56a2ec20d276d57e6b3a232ca8e292decd9ceb26af704d668acdca1329ae29fdcb4d0b44317c4b6a77747d194c5d767f5fd9b10240388607f6cb
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@
|
|
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.6.0]
|
7
|
+
- #158 from mmyoji/fix-docs-urls
|
8
|
+
- #159 from patchkit-net/bugfix/invalid-longpath-collision Fix invalid collision detection on paths that already contains path variables
|
9
|
+
- #161 from tongueroo/iam-role-name remove pretty iam role name, let CloudFormation generate
|
10
|
+
|
6
11
|
## [1.5.10]
|
7
12
|
- #157 Improve Route Change Detection: Path Variables
|
8
13
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -164,8 +164,8 @@ For more documentation, check out the official docs: [Ruby on Jets](http://rubyo
|
|
164
164
|
* [Quick Start](http://rubyonjets.com/quick-start/)
|
165
165
|
* [Local Jets Server](http://rubyonjets.com/docs/local-server/)
|
166
166
|
* [REPL Console](http://rubyonjets.com/docs/repl-console/)
|
167
|
-
* [Project Structure](http://rubyonjets.com/
|
168
|
-
* [App Configuration](http://rubyonjets.com/app-config/)
|
167
|
+
* [Project Structure](http://rubyonjets.com/docs/structure/)
|
168
|
+
* [App Configuration](http://rubyonjets.com/docs/app-config/)
|
169
169
|
* [Database Support](http://rubyonjets.com/docs/database-support/)
|
170
170
|
* [Polymorphic Support](http://rubyonjets.com/docs/polymorphic-support/)
|
171
171
|
* [Rails Support](http://rubyonjets.com/docs/rails-support/)
|
@@ -68,13 +68,43 @@ class Jets::Resource::ApiGateway::RestApi::Routes::Change
|
|
68
68
|
# posts#new
|
69
69
|
def recreate_to(method_uri)
|
70
70
|
md = method_uri.match(/function:(.*)\//)
|
71
|
-
|
72
|
-
|
71
|
+
function_arn = md[1] # IE: demo-dev-posts_controller-new
|
72
|
+
controller, action = get_controller_action(function_arn)
|
73
|
+
"#{controller}##{action}" # IE: posts#new
|
74
|
+
end
|
75
|
+
|
76
|
+
def get_controller_action(function_arn)
|
77
|
+
if function_arn.include?('_controller-')
|
78
|
+
controller_action_from_string(function_arn)
|
79
|
+
else
|
80
|
+
controller_action_from_api(function_arn)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
# TODO: If this hits the Lambda Rate limit, then list_functions also contains the Lambda
|
85
|
+
# function description. So we can paginate through list_functions results and store
|
86
|
+
# description from there if needed.
|
87
|
+
# Dont think this will be needed though because controller_action_from_string gets called
|
88
|
+
# most of the time. Also, user might be able to request their Lambda limit to be increased.
|
89
|
+
def controller_action_from_api(function_arn)
|
90
|
+
desc = lambda_function_description(function_arn)
|
91
|
+
controller, action = desc.split('#')
|
92
|
+
controller = controller.underscore.sub(/_controller$/,'')
|
93
|
+
[controller, action]
|
94
|
+
end
|
95
|
+
|
96
|
+
def controller_action_from_string(function_arn)
|
97
|
+
controller_action = function_arn.sub("#{Jets.project_namespace}-", '')
|
73
98
|
md = controller_action.match(/(.*)_controller-(.*)/)
|
74
99
|
controller = md[1]
|
75
100
|
controller = controller.gsub('-','/')
|
76
101
|
action = md[2]
|
77
|
-
|
102
|
+
[controller, action]
|
103
|
+
end
|
104
|
+
|
105
|
+
def lambda_function_description(function_arn)
|
106
|
+
resp = lambda.get_function(function_name: function_arn)
|
107
|
+
resp.configuration.description # contains full info: PostsController#index
|
78
108
|
end
|
79
109
|
|
80
110
|
# Duplicated in rest_api/change_detection.rb, base_path/role.rb, rest_api/routes.rb
|
@@ -5,11 +5,12 @@ module Jets::Resource::Iam
|
|
5
5
|
def definition
|
6
6
|
logical_id = role_logical_id
|
7
7
|
|
8
|
+
# Do not assign pretty role_name because long controller names might hit the 64-char
|
9
|
+
# limit. Also, IAM roles are global, so assigning role names prevents cross region deploys.
|
8
10
|
definition = {
|
9
11
|
logical_id => {
|
10
12
|
type: "AWS::IAM::Role",
|
11
13
|
properties: {
|
12
|
-
role_name: role_name,
|
13
14
|
path: "/",
|
14
15
|
assume_role_policy_document: {
|
15
16
|
version: "2012-10-17",
|
@@ -24,7 +25,7 @@ module Jets::Resource::Iam
|
|
24
25
|
}
|
25
26
|
|
26
27
|
definition[logical_id][:properties][:policies] = [
|
27
|
-
policy_name: "#{
|
28
|
+
policy_name: "#{policy_name[0..127]}", # required, limited to 128-chars
|
28
29
|
policy_document: policy_document,
|
29
30
|
] unless policy_document['Statement'].empty?
|
30
31
|
|
@@ -12,9 +12,9 @@ module Jets::Resource::Iam
|
|
12
12
|
"{namespace}_iam_role".underscore
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
15
|
+
def policy_name
|
16
16
|
class_namespace = replacements[:namespace].underscore.dasherize
|
17
|
-
"#{Jets.config.project_namespace}-#{class_namespace}-
|
17
|
+
"#{Jets.config.project_namespace}-#{class_namespace}-policy" # camelized because used as template value
|
18
18
|
end
|
19
19
|
|
20
20
|
def replacements
|
@@ -12,9 +12,9 @@ module Jets::Resource::Iam
|
|
12
12
|
"{namespace}_iam_role".underscore
|
13
13
|
end
|
14
14
|
|
15
|
-
def
|
15
|
+
def policy_name
|
16
16
|
funcion_namespace = replacements[:namespace].underscore.dasherize
|
17
|
-
"#{Jets.config.project_namespace}-#{funcion_namespace}-
|
17
|
+
"#{Jets.config.project_namespace}-#{funcion_namespace}-policy" # camelized because used as template value
|
18
18
|
end
|
19
19
|
|
20
20
|
def replacements
|
@@ -125,10 +125,11 @@ module Jets::Resource::Lambda
|
|
125
125
|
handler = full_handler(props)
|
126
126
|
runtime = get_runtime(props)
|
127
127
|
managed = {
|
128
|
-
function_name: function_name,
|
129
128
|
handler: handler,
|
130
129
|
runtime: runtime,
|
130
|
+
description: description,
|
131
131
|
}
|
132
|
+
managed[:function_name] = function_name if function_name
|
132
133
|
layers = get_layers(runtime)
|
133
134
|
managed[:layers] = layers if layers
|
134
135
|
props.merge!(managed)
|
@@ -184,6 +185,7 @@ module Jets::Resource::Lambda
|
|
184
185
|
"jets/code/code-#{checksum}.zip" # s3_key
|
185
186
|
end
|
186
187
|
|
188
|
+
MAX_FUNCTION_NAME_SIZE = 64
|
187
189
|
# Examples:
|
188
190
|
# "#{Jets.config.project_namespace}-sleep_job-perform"
|
189
191
|
# "demo-dev-sleep_job-perform"
|
@@ -195,7 +197,20 @@ module Jets::Resource::Lambda
|
|
195
197
|
# method: admin-pages_controller-index
|
196
198
|
method = @app_class.underscore
|
197
199
|
method = method.sub('/','-').gsub(/[^0-9a-z\-_]/i, '') + "-#{@task.meth}"
|
198
|
-
"#{Jets.config.project_namespace}-#{method}"
|
200
|
+
function_name = "#{Jets.config.project_namespace}-#{method}"
|
201
|
+
# Returns nil if function name is too long.
|
202
|
+
# CloudFormation will managed the the function name in this case.
|
203
|
+
# A pretty function name won't be generated but the deploy will be successful.
|
204
|
+
function_name.size > MAX_FUNCTION_NAME_SIZE ? nil : function_name
|
205
|
+
end
|
206
|
+
|
207
|
+
def description
|
208
|
+
# Example values:
|
209
|
+
# @app_class: Admin/PagesController
|
210
|
+
# @task.meth: index
|
211
|
+
# Returns:
|
212
|
+
# Admin/PagesController#index
|
213
|
+
"#{@app_class}##{@task.meth}"
|
199
214
|
end
|
200
215
|
end
|
201
216
|
end
|
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.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|