jets 3.0.8 → 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: db3aab7667c9ee9aaa2149d30132dbf423516b4195e643dad4f8a2108fe03bfc
4
- data.tar.gz: 5e126f386e4d0bba1c3714e66470e692c08c099c932f8f6a1c9a62556487aabe
3
+ metadata.gz: bccb565973aab7e6793924820d026a97e056a75fc5827f0e227d11d17f2c76d8
4
+ data.tar.gz: c0935a069903b2406e4c06948d35e679d4a2837dc002bc56168f94a4c441774f
5
5
  SHA512:
6
- metadata.gz: 3c57ac868b4d54d0eff01884597af16188f59584eb20c8a348ce9bb8936e19dd50cc6f5d2271b7e0a4a0078586b40be9dcb5f47f92a870164482369662831aaa
7
- data.tar.gz: 83757df158f81b1447652c1edbe5e684c3cad325a7326a567d6fab391f6bae3ed86b847a87b17a62fb07314053e40e1a10575b8a97d76c8107ff598980ad285d
6
+ metadata.gz: a0368aad05b5cd49fb3e5f175e672306c62906b9f3909fc8e9df29ca722cff15695a8c9de2a9d5f34bfe404828fc06401f04bc1b63ed6486c57f963191d3de43
7
+ data.tar.gz: 90eab98e9f5664bb27b67a14f5d3b2cba53f4cdfabd8828629d467cd0c00351746c6425ef5a38080cdec814ebd2d69aa480d132415bf6531bf1775f37bf944d1
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
+ ## [3.0.9] - 2021-06-14
7
+ - fix content type s3 metadata (#564)
8
+
6
9
  ## [3.0.8] - 2021-06-03
7
10
  - Update cli.md (#560)
8
11
  - respect .jetsignore also (#562)
@@ -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
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "3.0.8"
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.8
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-06-03 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