jets 3.0.2 → 3.0.7
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 +24 -0
- data/LICENSE.txt +1 -1
- data/README.md +7 -1
- data/jets.gemspec +2 -2
- data/lib/jets/aws_info.rb +1 -1
- data/lib/jets/builders/md5_zip.rb +1 -1
- data/lib/jets/commands/templates/skeleton/Gemfile.tt +2 -2
- data/lib/jets/controller/callbacks.rb +6 -18
- data/lib/jets/controller/rack/adapter.rb +14 -8
- data/lib/jets/internal/app/controllers/jets/public_controller.rb +2 -2
- data/lib/jets/overrides/rails/migration_checker.rb +6 -2
- data/lib/jets/resource/lambda/function.rb +8 -1
- data/lib/jets/spec_helpers/controllers.rb +2 -1
- data/lib/jets/spec_helpers/controllers/request.rb +11 -5
- data/lib/jets/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c26430b6fb7be2b2416c0d165a4a87a064b16aa99a41b3dab1db9134cb586a92
|
4
|
+
data.tar.gz: fc8d1c040f46b369dc1b0ed588e8d757d3a55eda860f1716b4f39d48a1347def
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd820b61fd4bfec9703035ec6e0cf04d7978d0cc4a001b370fc741874cef80b3bf7bebb8635d7af116892d85ea681cdc2d94b2b7bdec28b0037218df9b4d9dc0
|
7
|
+
data.tar.gz: a982e6f67b17c74881f393359334a492050ed0cc719daffaee1955f04746df2f88bcdfd7f253ad9655f8230d196abcdaffa6c681a6cdfa845e5dcabaaad6c32a
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,30 @@
|
|
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
|
+
## [3.0.7] - 2021-05-27
|
7
|
+
- Dont bypass class_attribute setters (#559)
|
8
|
+
- update pg version in jets new Gemfile to latest (#558)
|
9
|
+
|
10
|
+
## [3.0.6] - 2021-05-27
|
11
|
+
- Handle Errors::InvalidClientTokenId when `get_caller_identity` fails (#543)
|
12
|
+
- Use description specifed in function properties (#545)
|
13
|
+
- allow multi value response headers (#556)
|
14
|
+
- rails support update
|
15
|
+
|
16
|
+
## [3.0.5] - 2021-04-23
|
17
|
+
- [#542](https://github.com/boltops-tools/jets/pull/542) fix custom layers
|
18
|
+
|
19
|
+
## [3.0.4] - 2021-04-13
|
20
|
+
- [#537](https://github.com/boltops-tools/jets/pull/537) Docs Add instructions for aws-cli prerequisite
|
21
|
+
- [#528](https://github.com/boltops-tools/jets/pull/528) Adjust permissions to fix custom layer
|
22
|
+
- [#539](https://github.com/boltops-tools/jets/pull/539) FIX DEPRECATION WARNING: connection_config is deprecated
|
23
|
+
- [#540](https://github.com/boltops-tools/jets/pull/540) Allow body param for controller request spec helpers
|
24
|
+
- update serverlessgems gem
|
25
|
+
|
26
|
+
## [3.0.3] - 2021-03-24
|
27
|
+
- [#532](https://github.com/boltops-tools/jets/pull/532) Update Copy Write Year
|
28
|
+
- [#536](https://github.com/boltops-tools/jets/pull/536) use mini_mime instead
|
29
|
+
|
6
30
|
## [3.0.2] - 2021-01-12
|
7
31
|
- update serverlessgems gem
|
8
32
|
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -12,8 +12,14 @@ Ruby and Lambda splat out a baby and that child's name is [Jets](http://rubyonje
|
|
12
12
|
|
13
13
|
[](https://www.boltops.com)
|
14
14
|
|
15
|
+
Please **watch/star** this repo to help grow and support the project.
|
16
|
+
|
15
17
|
**Upgrading**: If you are upgrading Jets, please check on the [Upgrading Notes](http://rubyonjets.com/docs/extras/upgrading/).
|
16
18
|
|
19
|
+
## Sponsors
|
20
|
+
|
21
|
+
[](https://arist.co/)
|
22
|
+
|
17
23
|
## What is Ruby on Jets?
|
18
24
|
|
19
25
|
Jets is a Ruby Serverless Framework. Jets allows you to create serverless applications with a beautiful language: Ruby. It includes everything required to build an application and deploy it to AWS Lambda.
|
@@ -189,7 +195,7 @@ For more documentation, check out the official docs: [Ruby on Jets](http://rubyo
|
|
189
195
|
* [Official AWS Ruby Support for Jets](https://blog.boltops.com/2018/12/12/official-aws-ruby-support-for-jets-serverless-framework)
|
190
196
|
* [Build an API with Jets](https://blog.boltops.com/2019/01/13/build-an-api-service-with-jets-ruby-serverless-framework)
|
191
197
|
* [Serverless Ruby Cron Jobs Tutorial: Route53 Backup](https://blog.boltops.com/2019/01/03/serverless-ruby-cron-jobs-with-jets-route53-backup)
|
192
|
-
* [Serverless Slack Commands: Fun with AWS Image Recognition](https://blog.boltops.com/
|
198
|
+
* [Serverless Slack Commands: Fun with AWS Image Recognition](https://blog.boltops.com/2021/02/02/serverless-slack-commands-with-ruby)
|
193
199
|
* [Jets Afterburner: Rails Support](https://blog.boltops.com/2018/12/21/jets-afterburner-serverless-rails-on-aws-lambda-in-5-minutes)
|
194
200
|
* [Jets Mega Mode: Jets and Rails](https://blog.boltops.com/2018/11/03/jets-mega-mode-run-rails-on-aws-lambda)
|
195
201
|
* [Toronto Serverless Presentation](https://blog.boltops.com/2018/09/25/toronto-serverless-presentation-jets-framework-on-aws-lambda)
|
data/jets.gemspec
CHANGED
@@ -52,12 +52,12 @@ Gem::Specification.new do |spec|
|
|
52
52
|
spec.add_dependency "jets-html-sanitizer"
|
53
53
|
spec.add_dependency "kramdown"
|
54
54
|
spec.add_dependency "memoist"
|
55
|
-
spec.add_dependency "
|
55
|
+
spec.add_dependency "mini_mime"
|
56
56
|
spec.add_dependency "rack"
|
57
57
|
spec.add_dependency "railties", "~> 6.1.0" # for ActiveRecord database_tasks.rb
|
58
58
|
spec.add_dependency "rainbow"
|
59
59
|
spec.add_dependency "recursive-open-struct"
|
60
|
-
spec.add_dependency "serverlessgems", "~> 0.1.
|
60
|
+
spec.add_dependency "serverlessgems", "~> 0.1.3"
|
61
61
|
spec.add_dependency "shotgun"
|
62
62
|
spec.add_dependency "text-table"
|
63
63
|
spec.add_dependency "thor"
|
data/lib/jets/aws_info.rb
CHANGED
@@ -55,7 +55,7 @@ module Jets
|
|
55
55
|
ENV['AWS_REGION'] ||= region
|
56
56
|
begin
|
57
57
|
sts.get_caller_identity.account
|
58
|
-
rescue Aws::Errors::MissingCredentialsError, Aws::Errors::NoSuchEndpointError
|
58
|
+
rescue Aws::Errors::MissingCredentialsError, Aws::Errors::NoSuchEndpointError, Aws::STS::Errors::InvalidClientTokenId
|
59
59
|
puts "INFO: You're missing AWS credentials. Only local services are currently available"
|
60
60
|
rescue Seahorse::Client::NetworkingError
|
61
61
|
puts "INFO: No internet connection available. Only local services are currently available"
|
@@ -23,7 +23,7 @@ module Jets::Builders
|
|
23
23
|
# => Creating zip file for /tmp/jets/demo/stage/bundled
|
24
24
|
|
25
25
|
# https://serverfault.com/questions/265675/how-can-i-zip-compress-a-symlink
|
26
|
-
command = "cd #{@path} && zip --symlinks -rq #{zip_file} ."
|
26
|
+
command = "cd #{@path} && chmod -R 755 . && zip --symlinks -rq #{zip_file} ."
|
27
27
|
sh(command)
|
28
28
|
# move out of the lower folder to the stage folder
|
29
29
|
# mv /tmp/jets/demo/stage/code/code.zip /tmp/jets/demo/stage/code.zip
|
@@ -9,11 +9,11 @@ gem "jetpacker"
|
|
9
9
|
<% if @database == 'postgresql' %>
|
10
10
|
# Include pg gem if you are using ActiveRecord, remove next line
|
11
11
|
# and config/database.yml file if you are not
|
12
|
-
gem "pg", "~> 1.
|
12
|
+
gem "pg", "~> 1.2.3"
|
13
13
|
<% elsif @database == 'mysql' %>
|
14
14
|
# Include mysql2 gem if you are using ActiveRecord, remove next line
|
15
15
|
# and config/database.yml file if you are not
|
16
|
-
gem "mysql2", "~> 0.5.
|
16
|
+
gem "mysql2", "~> 0.5.3"
|
17
17
|
<% end %>
|
18
18
|
<% unless options[:mode] == 'job' -%>
|
19
19
|
gem "dynomite"
|
@@ -17,10 +17,12 @@ class Jets::Controller
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def skip_before_action(meth, options = {})
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
self.before_actions = before_actions
|
21
|
+
.reject { |act| act.first.to_s == meth.to_s }
|
22
|
+
|
23
|
+
# If options include the `only` option,
|
24
|
+
# re-add the action using the setter with the `except` option
|
25
|
+
before_action(meth, { except: options[:only] }) if options[:only].present?
|
24
26
|
end
|
25
27
|
|
26
28
|
alias_method :append_before_action, :before_action
|
@@ -38,20 +40,6 @@ class Jets::Controller
|
|
38
40
|
end
|
39
41
|
|
40
42
|
alias_method :append_after_action, :after_action
|
41
|
-
|
42
|
-
private
|
43
|
-
|
44
|
-
def append_except_to_callbacks(callback_methods, meth, excepted_methods)
|
45
|
-
callback_methods.map! do |callback_method|
|
46
|
-
if callback_method.first.to_s == meth.to_s
|
47
|
-
exceptions = callback_method.second[:except] || []
|
48
|
-
exceptions.concat(Array.wrap(excepted_methods))
|
49
|
-
callback_method.second[:except] = exceptions
|
50
|
-
end
|
51
|
-
|
52
|
-
callback_method
|
53
|
-
end
|
54
|
-
end
|
55
43
|
end
|
56
44
|
end # included
|
57
45
|
|
@@ -34,14 +34,20 @@ module Jets::Controller::Rack
|
|
34
34
|
body = body.respond_to?(:read) ? body.read : body
|
35
35
|
body = Base64.encode64(body) if base64
|
36
36
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
37
|
+
{}.tap do |resp|
|
38
|
+
resp['statusCode'] = status
|
39
|
+
resp['body'] = body
|
40
|
+
resp['isBase64Encoded'] = base64
|
41
|
+
add_response_headers(resp, headers)
|
42
|
+
adjust_for_elb(resp)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def add_response_headers(resp, headers)
|
47
|
+
resp['headers'] = headers.reject { |_, val| val.is_a?(Array) }
|
48
|
+
multi_value_headers = headers.select { |_, val| val.is_a?(Array) }
|
49
|
+
|
50
|
+
resp['multiValueHeaders'] = multi_value_headers unless multi_value_headers.blank?
|
45
51
|
end
|
46
52
|
|
47
53
|
# Note: ELB is not officially support. This is just in case users wish to manually
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require "rack/mime"
|
2
|
-
require "
|
2
|
+
require "mini_mime"
|
3
3
|
|
4
4
|
class Jets::PublicController < Jets::Controller::Base
|
5
5
|
layout false
|
@@ -12,7 +12,7 @@ class Jets::PublicController < Jets::Controller::Base
|
|
12
12
|
|
13
13
|
if File.exist?(catchall_path)
|
14
14
|
content_type = Rack::Mime.mime_type(File.extname(catchall_path))
|
15
|
-
binary = !
|
15
|
+
binary = !MiniMime.lookup_by_filename(catchall_path).content_type.include?("text")
|
16
16
|
|
17
17
|
# For binary support to work, the client also has to send the right Accept header.
|
18
18
|
# And the media type has been to added to api gateway.
|
@@ -1,11 +1,15 @@
|
|
1
1
|
module ActiveRecord
|
2
2
|
module MigrationChecker
|
3
3
|
def prepare_test_db
|
4
|
-
current_config = ::ActiveRecord::Base.
|
4
|
+
current_config = ::ActiveRecord::Base.connection_db_config
|
5
5
|
all_configs = ::ActiveRecord::Base.configurations.configs_for(env_name: Jets.env)
|
6
6
|
|
7
7
|
needs_update = !all_configs.all? do |db_config|
|
8
|
-
::ActiveRecord::Tasks::DatabaseTasks.schema_up_to_date?(
|
8
|
+
::ActiveRecord::Tasks::DatabaseTasks.schema_up_to_date?(
|
9
|
+
db_config.configuration_hash,
|
10
|
+
::ActiveRecord::Base.schema_format,
|
11
|
+
nil
|
12
|
+
)
|
9
13
|
end
|
10
14
|
|
11
15
|
if needs_update
|
@@ -123,6 +123,7 @@ module Jets::Resource::Lambda
|
|
123
123
|
def finalize_properties!(props)
|
124
124
|
handler = full_handler(props)
|
125
125
|
runtime = get_runtime(props)
|
126
|
+
description = get_descripton(props)
|
126
127
|
managed = {
|
127
128
|
handler: handler,
|
128
129
|
runtime: runtime,
|
@@ -136,6 +137,8 @@ module Jets::Resource::Lambda
|
|
136
137
|
|
137
138
|
def get_layers(runtime)
|
138
139
|
return nil unless runtime =~ /^ruby/
|
140
|
+
return Jets.config.lambda.layers if Jets.config.gems.disable
|
141
|
+
|
139
142
|
["!Ref GemLayer"] + Jets.config.lambda.layers
|
140
143
|
end
|
141
144
|
|
@@ -202,7 +205,11 @@ module Jets::Resource::Lambda
|
|
202
205
|
function_name.size > Jets::MAX_FUNCTION_NAME_SIZE ? nil : function_name
|
203
206
|
end
|
204
207
|
|
205
|
-
def
|
208
|
+
def get_descripton(props)
|
209
|
+
props[:description] || default_description
|
210
|
+
end
|
211
|
+
|
212
|
+
def default_description
|
206
213
|
# Example values:
|
207
214
|
# @app_class: Admin/PagesController
|
208
215
|
# @task.meth: index
|
@@ -32,7 +32,8 @@ module Jets::SpecHelpers
|
|
32
32
|
request.params.query_params ||= params.delete(:params)
|
33
33
|
request.params.query_params ||= params
|
34
34
|
else
|
35
|
-
request.params.body_params = params.delete(:
|
35
|
+
request.params.body_params = params.delete(:body)
|
36
|
+
request.params.body_params ||= params.delete(:params)
|
36
37
|
request.params.body_params ||= params
|
37
38
|
end
|
38
39
|
|
@@ -31,14 +31,20 @@ module Jets::SpecHelpers::Controllers
|
|
31
31
|
json['headers'] = (headers || {}).stringify_keys
|
32
32
|
|
33
33
|
if method != :get
|
34
|
-
json['headers']['Content-Type']
|
35
|
-
body = Rack::Multipart.build_multipart(params.body_params)
|
34
|
+
json['headers']['Content-Type'] ||= 'application/x-www-form-urlencoded'
|
36
35
|
|
37
|
-
if
|
36
|
+
if params.body_params.is_a? String
|
37
|
+
body = params.body_params
|
38
38
|
json['headers']['Content-Length'] ||= body.length.to_s
|
39
|
-
json['headers']['Content-Type'] = "multipart/form-data; boundary=#{Rack::Multipart::MULTIPART_BOUNDARY}"
|
40
39
|
else
|
41
|
-
body = Rack::
|
40
|
+
body = Rack::Multipart.build_multipart(params.body_params)
|
41
|
+
|
42
|
+
if body
|
43
|
+
json['headers']['Content-Length'] ||= body.length.to_s
|
44
|
+
json['headers']['Content-Type'] = "multipart/form-data; boundary=#{Rack::Multipart::MULTIPART_BOUNDARY}"
|
45
|
+
else
|
46
|
+
body = Rack::Utils.build_nested_query(params.body_params)
|
47
|
+
end
|
42
48
|
end
|
43
49
|
|
44
50
|
json['body'] = Base64.encode64(body)
|
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: 3.0.
|
4
|
+
version: 3.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|
@@ -361,7 +361,7 @@ dependencies:
|
|
361
361
|
- !ruby/object:Gem::Version
|
362
362
|
version: '0'
|
363
363
|
- !ruby/object:Gem::Dependency
|
364
|
-
name:
|
364
|
+
name: mini_mime
|
365
365
|
requirement: !ruby/object:Gem::Requirement
|
366
366
|
requirements:
|
367
367
|
- - ">="
|
@@ -436,14 +436,14 @@ dependencies:
|
|
436
436
|
requirements:
|
437
437
|
- - "~>"
|
438
438
|
- !ruby/object:Gem::Version
|
439
|
-
version: 0.1.
|
439
|
+
version: 0.1.3
|
440
440
|
type: :runtime
|
441
441
|
prerelease: false
|
442
442
|
version_requirements: !ruby/object:Gem::Requirement
|
443
443
|
requirements:
|
444
444
|
- - "~>"
|
445
445
|
- !ruby/object:Gem::Version
|
446
|
-
version: 0.1.
|
446
|
+
version: 0.1.3
|
447
447
|
- !ruby/object:Gem::Dependency
|
448
448
|
name: shotgun
|
449
449
|
requirement: !ruby/object:Gem::Requirement
|