jets 1.9.23 → 1.9.24
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 +3 -0
- data/lib/jets.rb +2 -0
- data/lib/jets/application/defaults.rb +6 -8
- data/lib/jets/autoloaders.rb +1 -0
- data/lib/jets/commands/call/base_guesser.rb +27 -0
- data/lib/jets/commands/main.rb +1 -1
- data/lib/jets/commands/templates/skeleton/Gemfile.tt +1 -0
- data/lib/jets/resource/lambda/function.rb +1 -2
- data/lib/jets/stack.rb +3 -12
- data/lib/jets/stack/main/dsl/lambda.rb +1 -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: 2f1be1857a1221db9a29d0106fa74d9f2d773fe5f3c09eb877eb91dabfacf913
|
4
|
+
data.tar.gz: 93154ffb64b35f28d6af723d5d6309077480b083ddb67b9e69a5fdafc2e30aec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e6a216db6fe880c7474a22a104f5b323fec4fe7b2f784b5a8837608df7a24b6cff5be8e13151e5ee6e2ceb110ccfb9c6a629b40b0762f1128b50cc1c5c17c9a
|
7
|
+
data.tar.gz: 0b149b34bf275c7c77d373a43c6f4abe89710d40e2adca924a07a3a9e8d3d2b2add0c384b5e180495903748ab727b97f4c64c2e40aa3fa372c69e105a0b97171
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@
|
|
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/).
|
5
5
|
|
6
|
+
## [1.9.24]
|
7
|
+
- #301 Fix jets call for long function names. Lookup actual function names for long functions
|
8
|
+
|
6
9
|
## [1.9.23]
|
7
10
|
- #300 use .jets/project folder for afterburner instead of .jets/app
|
8
11
|
|
data/lib/jets.rb
CHANGED
@@ -23,14 +23,12 @@ class Jets::Application
|
|
23
23
|
}
|
24
24
|
policies = [logs, s3_readonly, s3_bucket]
|
25
25
|
|
26
|
-
|
27
|
-
cloudformation
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
policies << cloudformation
|
33
|
-
end
|
26
|
+
cloudformation = {
|
27
|
+
action: ["cloudformation:DescribeStacks", "cloudformation:DescribeStackResources"],
|
28
|
+
effect: "Allow",
|
29
|
+
resource: "arn:aws:cloudformation:#{Jets.aws.region}:#{Jets.aws.account}:stack/#{project_namespace}*",
|
30
|
+
}
|
31
|
+
policies << cloudformation
|
34
32
|
|
35
33
|
if Jets.config.function.vpc_config
|
36
34
|
vpc = {
|
data/lib/jets/autoloaders.rb
CHANGED
@@ -5,6 +5,8 @@
|
|
5
5
|
#
|
6
6
|
class Jets::Commands::Call
|
7
7
|
class BaseGuesser
|
8
|
+
include Jets::AwsServices
|
9
|
+
|
8
10
|
# provided_function_name:
|
9
11
|
# admin/related_pages_controller-list_all
|
10
12
|
# admin-related-pages-controller-list-all
|
@@ -28,6 +30,31 @@ class Jets::Commands::Call
|
|
28
30
|
|
29
31
|
code_path = class_name.underscore.gsub('/','-')
|
30
32
|
function_name = [Jets.config.project_namespace, code_path, method_name].join('-')
|
33
|
+
generated_function_name(function_name)
|
34
|
+
end
|
35
|
+
|
36
|
+
def generated_function_name(function_name)
|
37
|
+
if function_name.size > Jets::MAX_FUNCTION_NAME_SIZE # name generated by CloudFormation
|
38
|
+
logical_id = @class_name.gsub('::','')
|
39
|
+
app_stack_arn = lookup(parent_stack[:outputs], logical_id)
|
40
|
+
|
41
|
+
resources = stack_resources(app_stack_arn)
|
42
|
+
resource = resources.find { |r| r.logical_resource_id == method_name.camelize + "LambdaFunction" } # method_name only contains the method
|
43
|
+
resource.physical_resource_id # actual function name
|
44
|
+
else
|
45
|
+
function_name
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
# Class variable caches
|
50
|
+
@@stack_resources = {}
|
51
|
+
def stack_resources(stack_name)
|
52
|
+
@@stack_resources[stack_name] ||= cfn.describe_stack_resources(stack_name: stack_name).stack_resources
|
53
|
+
end
|
54
|
+
|
55
|
+
@@parent_stack = nil
|
56
|
+
def parent_stack
|
57
|
+
@@parent_stack ||= cfn.describe_stacks(stack_name: Jets::Naming.parent_stack_name).stacks.first
|
31
58
|
end
|
32
59
|
end
|
33
60
|
end
|
data/lib/jets/commands/main.rb
CHANGED
@@ -80,7 +80,7 @@ module Jets::Commands
|
|
80
80
|
option :qualifier, desc: "Lambda function version or alias name"
|
81
81
|
option :show_log, type: :boolean, desc: "Shows last 4KB of log in the x-amz-log-result header"
|
82
82
|
option :lambda_proxy, type: :boolean, default: true, desc: "Enables automatic Lambda proxy transformation of the event payload"
|
83
|
-
option :guess, type: :boolean, default: true, desc: "Enables guess mode. Uses inference to allows use of all dashes to specify functions.
|
83
|
+
option :guess, type: :boolean, default: true, desc: "Enables guess mode. Uses inference to allows use of all dashes to specify functions. Guess mode verifies that the function exists in the code base."
|
84
84
|
option :local, type: :boolean, desc: "Enables local mode. Instead of invoke the AWS Lambda function, the method gets called locally with current app code. With local mode guess mode is always used."
|
85
85
|
def call(function_name, payload='')
|
86
86
|
# Printing to stdout can mangle up the response when piping
|
@@ -184,7 +184,6 @@ module Jets::Resource::Lambda
|
|
184
184
|
"jets/code/code-#{checksum}.zip" # s3_key
|
185
185
|
end
|
186
186
|
|
187
|
-
MAX_FUNCTION_NAME_SIZE = 64
|
188
187
|
# Examples:
|
189
188
|
# "#{Jets.config.project_namespace}-sleep_job-perform"
|
190
189
|
# "demo-dev-sleep_job-perform"
|
@@ -200,7 +199,7 @@ module Jets::Resource::Lambda
|
|
200
199
|
# Returns nil if function name is too long.
|
201
200
|
# CloudFormation will managed the the function name in this case.
|
202
201
|
# A pretty function name won't be generated but the deploy will be successful.
|
203
|
-
function_name.size > MAX_FUNCTION_NAME_SIZE ? nil : function_name
|
202
|
+
function_name.size > Jets::MAX_FUNCTION_NAME_SIZE ? nil : function_name
|
204
203
|
end
|
205
204
|
|
206
205
|
def description
|
data/lib/jets/stack.rb
CHANGED
@@ -61,20 +61,11 @@ module Jets
|
|
61
61
|
end
|
62
62
|
memoize :template
|
63
63
|
|
64
|
-
#
|
65
|
-
#
|
66
|
-
# Jets::Stack.has_resources?
|
67
|
-
#
|
68
|
-
def has_resources?
|
69
|
-
# need to eager load the app/shared resources in order to check if shared resources have been registered
|
70
|
-
eager_load_shared_resources!
|
71
|
-
!!subclasses.detect do |subclass|
|
72
|
-
subclass.build?
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
64
|
+
# Eager loading the app/shared resources to ensure shared resources have been registered.
|
65
|
+
# Not being used anymore but keeping around just in case for now.
|
76
66
|
def eager_load_shared_resources!
|
77
67
|
Dir.glob("#{Jets.root}/app/shared/**").each do |path|
|
68
|
+
next if path.include?("app/shared/functions")
|
78
69
|
Jets::Autoloaders.main.preload(path)
|
79
70
|
end
|
80
71
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
module Jets::Stack::Main::Dsl
|
2
2
|
module Lambda
|
3
|
-
MAX_FUNCTION_NAME_SIZE = 64
|
4
3
|
# Example:
|
5
4
|
#
|
6
5
|
# function(:hello,
|
@@ -38,7 +37,7 @@ module Jets::Stack::Main::Dsl
|
|
38
37
|
}
|
39
38
|
|
40
39
|
function_name = "#{Jets.config.project_namespace}-#{class_namespace}-#{meth}"
|
41
|
-
function_name = function_name.size > MAX_FUNCTION_NAME_SIZE ? nil : function_name
|
40
|
+
function_name = function_name.size > Jets::MAX_FUNCTION_NAME_SIZE ? nil : function_name
|
42
41
|
defaults[:function_name] = function_name if function_name
|
43
42
|
|
44
43
|
props = defaults.merge(props)
|
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.9.
|
4
|
+
version: 1.9.24
|
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-
|
11
|
+
date: 2019-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|