cdn_asset_gem 1.0.15 → 1.0.20
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 +10 -14
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32de47db9dfecb23b07d8823b110d0e7512a66c83949ff3a9b5aeb3970ea59a5
|
4
|
+
data.tar.gz: 685b2a2e52e9640400ff6b395d09bf88216e977e27d22599818dded16ac1cd28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1549e6bd1ffa57d30aaba3d4a83c6c2032749c0b58a1f3b9dc809133bd9960abf9bb4188d6acf64efe05f6d523bbdbc289ed3ac2d9ba2e68fe745a7ac697ff31
|
7
|
+
data.tar.gz: 5eda2961de0c7a4645c8cbb75ace6242e49e72aab1ba138fc4de3e293ef750ded906ab26c24223fb247cc49e94ef74b199dd45053572850573cc7ef6c10d74f5
|
@@ -4,26 +4,22 @@ module CdnAssetGem
|
|
4
4
|
def map_asset(root_path: '', asset_name:, file_type:)
|
5
5
|
file = "#{file_type}/#{asset_name}.min.#{file_type}"
|
6
6
|
assets_path = if root_path.empty? || root_path == '/'
|
7
|
-
'assets'
|
7
|
+
'global-assets'
|
8
8
|
else
|
9
9
|
"#{root_path}/assets"
|
10
10
|
end
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
JSON.parse(
|
11
|
+
begin
|
12
|
+
Rails.logger.info "CdnAssetGem INFO: file #{file}"
|
13
|
+
Rails.logger.info "CdnAssetGem INFO: assets_path #{assets_path}"
|
14
|
+
Rails.cache.fetch("cdn-asset-#{root_path}-#{file}", expires_in: 5.minutes) do
|
15
|
+
response = HTTP.get("#{ENV['CDN_URL']}#{assets_path}/rev-manifest.json")
|
16
|
+
Rails.logger.info "CdnAssetGem INFO: response #{response}"
|
17
|
+
"#{ENV['CDN_URL']}#{assets_path}/#{JSON.parse(response)[file]}"
|
18
18
|
end
|
19
|
-
|
20
|
-
|
21
|
-
"#{ENV['CDN_URL']}#{assets_path}/#{manifest_hash[file]}"
|
22
|
-
else
|
19
|
+
rescue StandardError => e
|
20
|
+
Rails.logger.error "CdnAssetGem ERROR: #{e}"
|
23
21
|
"#{ENV['CDN_URL']}#{assets_path}/#{file}"
|
24
22
|
end
|
25
|
-
resuce
|
26
|
-
"#{ENV['CDN_URL']}#{assets_path}/#{file}"
|
27
23
|
end
|
28
24
|
end
|
29
25
|
end
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cdn_asset_gem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phil Baker
|
8
8
|
- Murray Catto
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
date: 2018-11-21 00:00:00.000000000 Z
|
@@ -25,18 +25,18 @@ dependencies:
|
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
|
-
description:
|
29
|
-
email:
|
28
|
+
description:
|
29
|
+
email:
|
30
30
|
executables: []
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
34
|
- lib/cdn_asset_gem.rb
|
35
35
|
- lib/cdn_asset_gem/view/helpers.rb
|
36
|
-
homepage:
|
36
|
+
homepage:
|
37
37
|
licenses: []
|
38
38
|
metadata: {}
|
39
|
-
post_install_message:
|
39
|
+
post_install_message:
|
40
40
|
rdoc_options: []
|
41
41
|
require_paths:
|
42
42
|
- lib
|
@@ -51,9 +51,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '0'
|
53
53
|
requirements: []
|
54
|
-
|
55
|
-
|
56
|
-
signing_key:
|
54
|
+
rubygems_version: 3.1.2
|
55
|
+
signing_key:
|
57
56
|
specification_version: 4
|
58
57
|
summary: Asset generator
|
59
58
|
test_files: []
|