jets 3.0.4 → 3.0.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bab0f795e30686ac36cb7ca8065a2b17e0eabe96e80ca620c3d05e5240f9687
4
- data.tar.gz: 30cdf0d11b9514d3b03842a9dba10beb490b51b2023a4f4825bf4cfe5ab57a7e
3
+ metadata.gz: bccb565973aab7e6793924820d026a97e056a75fc5827f0e227d11d17f2c76d8
4
+ data.tar.gz: c0935a069903b2406e4c06948d35e679d4a2837dc002bc56168f94a4c441774f
5
5
  SHA512:
6
- metadata.gz: 262caf0c7c8300e0357b9d4edd04084a27236df6cef19c301c60f8528e7e9f9cde08011cb10a46f2148976b58b6fd0122e78e74a97b301e652f306fcc2fe318f
7
- data.tar.gz: cdb67db4e614b1fe070958f551aad768d455a930a6d8789594558c07d617ffb0e1899f3b70ff4fc9a6395700ad3dafc81ad5dac655926d22dc8b6f0a97466ff6
6
+ metadata.gz: a0368aad05b5cd49fb3e5f175e672306c62906b9f3909fc8e9df29ca722cff15695a8c9de2a9d5f34bfe404828fc06401f04bc1b63ed6486c57f963191d3de43
7
+ data.tar.gz: 90eab98e9f5664bb27b67a14f5d3b2cba53f4cdfabd8828629d467cd0c00351746c6425ef5a38080cdec814ebd2d69aa480d132415bf6531bf1775f37bf944d1
data/CHANGELOG.md CHANGED
@@ -3,6 +3,26 @@
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.9] - 2021-06-14
7
+ - fix content type s3 metadata (#564)
8
+
9
+ ## [3.0.8] - 2021-06-03
10
+ - Update cli.md (#560)
11
+ - respect .jetsignore also (#562)
12
+
13
+ ## [3.0.7] - 2021-05-27
14
+ - Dont bypass class_attribute setters (#559)
15
+ - update pg version in jets new Gemfile to latest (#558)
16
+
17
+ ## [3.0.6] - 2021-05-27
18
+ - Handle Errors::InvalidClientTokenId when `get_caller_identity` fails (#543)
19
+ - Use description specifed in function properties (#545)
20
+ - allow multi value response headers (#556)
21
+ - rails support update
22
+
23
+ ## [3.0.5] - 2021-04-23
24
+ - [#542](https://github.com/boltops-tools/jets/pull/542) fix custom layers
25
+
6
26
  ## [3.0.4] - 2021-04-13
7
27
  - [#537](https://github.com/boltops-tools/jets/pull/537) Docs Add instructions for aws-cli prerequisite
8
28
  - [#528](https://github.com/boltops-tools/jets/pull/528) Adjust permissions to fix custom layer
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"
@@ -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)
@@ -1,5 +1,6 @@
1
1
  require 'action_view'
2
2
  require 'digest'
3
+ require 'rack/mime'
3
4
 
4
5
  module Jets::Cfn
5
6
  class Upload
@@ -8,12 +9,6 @@ module Jets::Cfn
8
9
 
9
10
  attr_reader :bucket_name
10
11
 
11
- CONTENT_TYPES_BY_EXTENSION = {
12
- '.css' => 'text/css',
13
- '.js' => 'application/javascript',
14
- '.html' => 'text/html'
15
- }
16
-
17
12
  def initialize(bucket_name)
18
13
  @bucket_name = bucket_name
19
14
  end
@@ -93,16 +88,23 @@ module Jets::Cfn
93
88
  end
94
89
 
95
90
  def upload_to_s3(full_path)
96
- return if identical_on_s3?(full_path)
91
+ return if identical_on_s3?(full_path) && !ENV['JETS_ASSET_UPLOAD_FORCE']
97
92
 
98
93
  key = s3_key(full_path)
99
94
  obj = s3_resource.bucket(bucket_name).object(key)
100
- puts "Uploading and setting content type for s3://#{bucket_name}/#{key}" # uncomment to see and debug
101
- obj.upload_file(full_path, { acl: "public-read", cache_control: cache_control }.merge(content_type_headers(full_path)))
95
+ content_type = content_type_headers(full_path)
96
+ puts "Uploading and setting content type for s3://#{bucket_name}/#{key} content_type #{content_type[:content_type].inspect}"
97
+ obj.upload_file(full_path, { acl: "public-read", cache_control: cache_control }.merge(content_type))
102
98
  end
103
99
 
100
+ CONTENT_TYPES_BY_EXTENSION = {
101
+ '.css' => 'text/css',
102
+ '.html' => 'text/html',
103
+ '.js' => 'application/javascript',
104
+ }
104
105
  def content_type_headers(full_path)
105
- content_type = CONTENT_TYPES_BY_EXTENSION[File.extname(full_path)]
106
+ ext = File.extname(full_path)
107
+ content_type = CONTENT_TYPES_BY_EXTENSION[ext] || Rack::Mime.mime_type(ext)
106
108
  if content_type
107
109
  { content_type: content_type }
108
110
  else
@@ -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
@@ -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
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "3.0.4"
2
+ VERSION = "3.0.9"
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.4
4
+ version: 3.0.9
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-04-13 00:00:00.000000000 Z
11
+ date: 2021-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer