Skip to content

A platform for community discussion. Free, open, simple.

FIX: S3 rake task can ignore yarn.lock

Robin Ward08fbf199ad75
diff --git a/lib/tasks/s3.rake b/lib/tasks/s3.rake
index 1f0ee2e08dc..7f6b0f79b9d 100644
--- a/lib/tasks/s3.rake
+++ b/lib/tasks/s3.rake
@@ -71,27 +71,26 @@ def assets
manifest.assets.each do |_, path|
fullpath = (Rails.root + "public/assets/#{path}").to_s
- mime = MiniMime.lookup_by_filename(fullpath)
- if mime.nil?
- STDERR.puts "ERROR: could not determine mime type for #{fullpath}"
- end
+ # Ignore files we can't find the mime type of, like yarn.lock
+ if mime = MiniMime.lookup_by_filename(fullpath)
+ content_type = mime.content_type
- content_type = mime.content_type
+ asset_path = "assets/#{path}"
+ results << [fullpath, asset_path, content_type]
- asset_path = "assets/#{path}"
- results << [fullpath, asset_path, content_type]
+ if File.exist?(fullpath + '.br')
+ results << [fullpath + '.br', brotli_s3_path(asset_path), content_type, 'br']
+ end
- if File.exist?(fullpath + '.br')
- results << [fullpath + '.br', brotli_s3_path(asset_path), content_type, 'br']
- end
+ if File.exist?(fullpath + '.gz')
+ results << [fullpath + '.gz', gzip_s3_path(asset_path), content_type, 'gzip']
+ end
- if File.exist?(fullpath + '.gz')
- results << [fullpath + '.gz', gzip_s3_path(asset_path), content_type, 'gzip']
+ if File.exist?(fullpath + '.map')
+ results << [fullpath + '.map', asset_path + '.map', 'application/json']
+ end
end
- if File.exist?(fullpath + '.map')
- results << [fullpath + '.map', asset_path + '.map', 'application/json']
- end
end
results