jets 3.0.3 → 3.0.8

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: d96f517061ff84ddf9fb3499904cb915608ce720dca3782144781127d4c514c7
4
- data.tar.gz: ed136863ef400a6aa43b82b8784c16606384144c36351adaeb85d48de42150fd
3
+ metadata.gz: db3aab7667c9ee9aaa2149d30132dbf423516b4195e643dad4f8a2108fe03bfc
4
+ data.tar.gz: 5e126f386e4d0bba1c3714e66470e692c08c099c932f8f6a1c9a62556487aabe
5
5
  SHA512:
6
- metadata.gz: 29d2a9608a6db8bd39e7a78fb30482121bd4bd3e17b2d92e89b28e5d502231f90f20f103e858e4719c893b41baab897d7e3904a6524cb4a67495825bc45b1ac5
7
- data.tar.gz: 281fe5d70d2a52750f270465c0a846009e77d6115b9696ad9b8f65cb8fab897dc57f38be7301eed1c6b6f05c633e1eb831a470fa11b1f0097e9f4c550b7e0174
6
+ metadata.gz: 3c57ac868b4d54d0eff01884597af16188f59584eb20c8a348ce9bb8936e19dd50cc6f5d2271b7e0a4a0078586b40be9dcb5f47f92a870164482369662831aaa
7
+ data.tar.gz: 83757df158f81b1447652c1edbe5e684c3cad325a7326a567d6fab391f6bae3ed86b847a87b17a62fb07314053e40e1a10575b8a97d76c8107ff598980ad285d
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.8] - 2021-06-03
7
+ - Update cli.md (#560)
8
+ - respect .jetsignore also (#562)
9
+
10
+ ## [3.0.7] - 2021-05-27
11
+ - Dont bypass class_attribute setters (#559)
12
+ - update pg version in jets new Gemfile to latest (#558)
13
+
14
+ ## [3.0.6] - 2021-05-27
15
+ - Handle Errors::InvalidClientTokenId when `get_caller_identity` fails (#543)
16
+ - Use description specifed in function properties (#545)
17
+ - allow multi value response headers (#556)
18
+ - rails support update
19
+
20
+ ## [3.0.5] - 2021-04-23
21
+ - [#542](https://github.com/boltops-tools/jets/pull/542) fix custom layers
22
+
23
+ ## [3.0.4] - 2021-04-13
24
+ - [#537](https://github.com/boltops-tools/jets/pull/537) Docs Add instructions for aws-cli prerequisite
25
+ - [#528](https://github.com/boltops-tools/jets/pull/528) Adjust permissions to fix custom layer
26
+ - [#539](https://github.com/boltops-tools/jets/pull/539) FIX DEPRECATION WARNING: connection_config is deprecated
27
+ - [#540](https://github.com/boltops-tools/jets/pull/540) Allow body param for controller request spec helpers
28
+ - update serverlessgems gem
29
+
6
30
  ## [3.0.3] - 2021-03-24
7
31
  - [#532](https://github.com/boltops-tools/jets/pull/532) Update Copy Write Year
8
32
  - [#536](https://github.com/boltops-tools/jets/pull/536) use mini_mime instead
data/README.md CHANGED
@@ -16,6 +16,10 @@ Please **watch/star** this repo to help grow and support the project.
16
16
 
17
17
  **Upgrading**: If you are upgrading Jets, please check on the [Upgrading Notes](http://rubyonjets.com/docs/extras/upgrading/).
18
18
 
19
+ ## Sponsors
20
+
21
+ [![](https://img.boltops.com/boltops/tools/jets/sponsors/arist.png)](https://arist.co/)
22
+
19
23
  ## What is Ruby on Jets?
20
24
 
21
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.
data/jets.gemspec CHANGED
@@ -57,7 +57,7 @@ Gem::Specification.new do |spec|
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.2"
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
@@ -35,6 +35,7 @@ module Jets::Builders
35
35
  removals = always_removals
36
36
  removals += get_removals("#{@project_root}/.gitignore")
37
37
  removals += get_removals("#{@project_root}/.dockerignore")
38
+ removals += get_removals("#{@project_root}/.jetsignore")
38
39
  removals = removals.reject do |p|
39
40
  jetskeep.find do |keep|
40
41
  p.include?(keep)
@@ -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.1.3"
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.2"
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
- # adds the methods in the only to the exception list for the callback
21
- return append_except_to_callbacks(self.before_actions, meth, options[:only]) if options[:only].present?
22
-
23
- self.before_actions.reject! { |el| el.first.to_s == meth.to_s }
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
- 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,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.3"
2
+ VERSION = "3.0.8"
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.3
4
+ version: 3.0.8
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-03-24 00:00:00.000000000 Z
11
+ date: 2021-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -436,14 +436,14 @@ dependencies:
436
436
  requirements:
437
437
  - - "~>"
438
438
  - !ruby/object:Gem::Version
439
- version: 0.1.2
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.2
446
+ version: 0.1.3
447
447
  - !ruby/object:Gem::Dependency
448
448
  name: shotgun
449
449
  requirement: !ruby/object:Gem::Requirement