cdn_asset_gem 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cdn_asset_gem/view/helpers.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80d38e94872ec129213f3efa13dd6f267d9828bac56263e1072773a961780068
|
4
|
+
data.tar.gz: 1e57df88dca6335f9991c495a19ccb85d6a5b9cfd867201611d097680a756642
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df112e100ee82c599b1ba0b89ec9a641cdd2880ec48c94ce52320102ae00209e9c9e927a067fd370a2800f3ee60d8f1717355a13515a8c9e04cb86016b2a2f83
|
7
|
+
data.tar.gz: 0d2dc015025474fad3fc724f49ff93c16f8b103874944a05ad9fefa5117179b982997fd4891eb1667944ed82fdf9147b9daa2697e24d4c21e8049cef30e3afda
|
@@ -3,7 +3,6 @@ module CdnAssetGem
|
|
3
3
|
module Helpers
|
4
4
|
def map_asset(root_path: '', asset_name:, file_type:)
|
5
5
|
file = "#{file_type}/#{asset_name}.min.#{file_type}"
|
6
|
-
|
7
6
|
if manifest_hash(root_path)[file]
|
8
7
|
"#{ENV['CDN_URL']}#{root_path}/assets/#{manifest_hash(root_path)[file]}"
|
9
8
|
else
|
@@ -13,7 +12,7 @@ module CdnAssetGem
|
|
13
12
|
Rails.logger.error "CdnAssetGem Error: #{e}"
|
14
13
|
"#{ENV['CDN_URL']}#{root_path}/assets/#{file}"
|
15
14
|
end
|
16
|
-
|
15
|
+
|
17
16
|
def manifest_hash(root_path)
|
18
17
|
if root_path.blank? || root_path == '/'
|
19
18
|
assets_path = '/assets'
|
@@ -24,6 +23,7 @@ module CdnAssetGem
|
|
24
23
|
Rails.cache.fetch("cdn-asset-#{root_path}", expires_in: 5.minutes) do
|
25
24
|
uri = URI("#{ENV['CDN_URL']}#{assets_path}/rev-manifest.json")
|
26
25
|
response = HTTP.get(uri)
|
26
|
+
Rails.logger.info "CdnAssetGem INFO: #{response}"
|
27
27
|
JSON.parse(response) if response.code == '200'
|
28
28
|
end
|
29
29
|
end
|