jets 3.0.1 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c54df907c0208fb0c84d1e3de9bea907883cb3dc83f05cd4bcd7da0c1930f2e
4
- data.tar.gz: 8b48dc566bff707edf6c53926c21e829ab95c73b0ac38b3116684994f08d7f0e
3
+ metadata.gz: 3ed89daa4700646743805940f6847196c9be132562bb1f4e90bf4cbeb0053e65
4
+ data.tar.gz: '09db7db5170f8aefffbd963986a007c1643814cd853c77451b27d06f2f522335'
5
5
  SHA512:
6
- metadata.gz: a5e74762613c04d90525319ef7f5cefad99f05a4ab96d9e98ff067cb872b11742d5e4e1385477f9a93376dba1f9661753db4195fc578d92b169e3b1bd42c394d
7
- data.tar.gz: 5894585a9597b5f2aa15fd607102867da0015122df44395a0854a801a5a8839427619a5edea0621592943e97865ed590cfcd36ac040389445d9675ed090e095d
6
+ metadata.gz: ddba3375086b7269d52cdcb0cbe2edca842ac94ab43fd65ea72d0a9ee5ab76cae42f3fc2f67678c4cb3a83533a9cf0993b84278e2268c133ed5bf1de57e41f20
7
+ data.tar.gz: 9907b63ebf1a56d1eb7ec51b171a98e3a9adb894cebd8dbdcb2a451510975da48704172c71401af5766c85a6ed0f39f804efa180b09aa2645364c62e5ec5397f
data/CHANGELOG.md CHANGED
@@ -3,6 +3,29 @@
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.6] - 2021-05-27
7
+ - Handle Errors::InvalidClientTokenId when `get_caller_identity` fails (#543)
8
+ - Use description specifed in function properties (#545)
9
+ - allow multi value response headers (#556)
10
+ - rails support update
11
+
12
+ ## [3.0.5] - 2021-04-23
13
+ - [#542](https://github.com/boltops-tools/jets/pull/542) fix custom layers
14
+
15
+ ## [3.0.4] - 2021-04-13
16
+ - [#537](https://github.com/boltops-tools/jets/pull/537) Docs Add instructions for aws-cli prerequisite
17
+ - [#528](https://github.com/boltops-tools/jets/pull/528) Adjust permissions to fix custom layer
18
+ - [#539](https://github.com/boltops-tools/jets/pull/539) FIX DEPRECATION WARNING: connection_config is deprecated
19
+ - [#540](https://github.com/boltops-tools/jets/pull/540) Allow body param for controller request spec helpers
20
+ - update serverlessgems gem
21
+
22
+ ## [3.0.3] - 2021-03-24
23
+ - [#532](https://github.com/boltops-tools/jets/pull/532) Update Copy Write Year
24
+ - [#536](https://github.com/boltops-tools/jets/pull/536) use mini_mime instead
25
+
26
+ ## [3.0.2] - 2021-01-12
27
+ - update serverlessgems gem
28
+
6
29
  ## [3.0.1] - 2021-01-12
7
30
  - [#524](https://github.com/boltops-tools/jets/pull/524) fix native gem detection
8
31
 
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2019 Tung Nguyen
1
+ Copyright (c) 2021 Tung Nguyen
2
2
 
3
3
  MIT License
4
4
 
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
  [![BoltOps Badge](https://img.boltops.com/boltops/badges/boltops-badge.png)](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://img.boltops.com/boltops/tools/jets/sponsors/arist.png)](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/2019/01/14/serverless-slack-commands-with-ruby)
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 "mimemagic"
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.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
@@ -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
- resp = {
38
- "statusCode" => status,
39
- "headers" => headers,
40
- "body" => body,
41
- "isBase64Encoded" => base64,
42
- }
43
- adjust_for_elb(resp)
44
- resp
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 "mimemagic"
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 = !MimeMagic.by_path(catchall_path).text?
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.connection_config
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?(db_config.config, ::ActiveRecord::Base.schema_format, nil, Jets.env, db_config.spec_name)
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 description
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(:params)
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'] = 'application/x-www-form-urlencoded'
35
- body = Rack::Multipart.build_multipart(params.body_params)
34
+ json['headers']['Content-Type'] ||= 'application/x-www-form-urlencoded'
36
35
 
37
- if body
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::Utils.build_nested_query(params.body_params)
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
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "3.0.1"
2
+ VERSION = "3.0.6"
3
3
  end
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.1
4
+ version: 3.0.6
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-01-12 00:00:00.000000000 Z
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: mimemagic
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.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.1
446
+ version: 0.1.3
447
447
  - !ruby/object:Gem::Dependency
448
448
  name: shotgun
449
449
  requirement: !ruby/object:Gem::Requirement