cdn_asset_gem 1.0.14 → 1.0.15
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 +4 -5
- data/lib/cdn_asset_gem.rb +0 -1
- 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: a2a61e0f8b167ab57242c3aaf4c7d8786e25071905816e57d1efa31c1204bfd6
|
4
|
+
data.tar.gz: 65d84d1ce5a5a3f31e8bf5d227f35697dfc31e701ab08c99395fbfb90c16b2f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87cf01ae7f7b71de0a0d3d27fad48d0c9650ce13569ca09f15279adc67241c02b1ef9fa04bb4e7298c34697cb46a6197ce7bd4360455e22bd36927eeba0c01b9
|
7
|
+
data.tar.gz: 7f821143370c77b0726e4522b5ed40c60c8e835f3da139247469c550fadeeaf43dff1c0c86cffdbca7813732c8b248449496d690ed2f7f3b6bae1abd53c94a3d
|
@@ -3,18 +3,18 @@ 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
|
-
assets_path = if root_path.
|
6
|
+
assets_path = if root_path.empty? || root_path == '/'
|
7
7
|
'assets'
|
8
8
|
else
|
9
9
|
"#{root_path}/assets"
|
10
10
|
end
|
11
11
|
manifest_hash = Rails.cache.fetch("cdn-asset-#{root_path}-#{asset_name}", expires_in: 5.minutes) do
|
12
12
|
response = HTTP.get("#{ENV['CDN_URL']}#{assets_path}/rev-manifest.json")
|
13
|
-
|
13
|
+
puts "CdnAssetGem INFO: response #{response}"
|
14
14
|
if response.code == '200'
|
15
15
|
JSON.parse(response)
|
16
16
|
else
|
17
|
-
JSON.parse(
|
17
|
+
JSON.parse('{}')
|
18
18
|
end
|
19
19
|
end
|
20
20
|
if manifest_hash[file]
|
@@ -22,8 +22,7 @@ module CdnAssetGem
|
|
22
22
|
else
|
23
23
|
"#{ENV['CDN_URL']}#{assets_path}/#{file}"
|
24
24
|
end
|
25
|
-
|
26
|
-
Rails.logger.error "CdnAssetGem Error: #{e}"
|
25
|
+
resuce
|
27
26
|
"#{ENV['CDN_URL']}#{assets_path}/#{file}"
|
28
27
|
end
|
29
28
|
end
|
data/lib/cdn_asset_gem.rb
CHANGED