cdn_asset_gem 1.0.16 → 1.0.17

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da844a0e522b75a46430e240a12126598a768885b94ddbd40a4d8c42b4f7233a
4
- data.tar.gz: 0ab970c09f0eda6f7fa981bf587fe41fe328e2b8f9461f17292c32792440d62f
3
+ metadata.gz: 76004edfba5f9dbe8159c1d3916804115067a3dcd72b34470e06c982a3efc30f
4
+ data.tar.gz: 36d0a41101d70a3ac3771ff09a93d3bf3c848e3aa7d3085ad55861bcf2762bb3
5
5
  SHA512:
6
- metadata.gz: 1ec24caaf243ba063d4d9090ff59d827155b9832bfa9837bdc052727af33c3edf0c42cfcb6162c3c868cac35f93343f473a51769c4897f1a1f540f461cc3568e
7
- data.tar.gz: 4d0c0067b20a416a99f01af8403b4c8a0fc2c03d4ba391c1bf63a72a1e084f48319aa54b87262fa4378557c835c08766415b3fb271c2a726fa166619ca30ab6d
6
+ metadata.gz: 5ed21f3a2ff48cb24d1784093baac18941a16e6d93143479d5bc03fdfde135a2b44fe8892684e367dbdb792806dd40968782c71e0354708523d8e88d43148a06
7
+ data.tar.gz: 63be1c430c73cb1a22b2f453bce52917fd33b988ad7d0b039c7016cf429f750d68d123c097d0b0e95c69f22c14528c21c6f231607aa57c4c590dfdd8aea0b8ed
@@ -8,22 +8,18 @@ module CdnAssetGem
8
8
  else
9
9
  "#{root_path}/assets"
10
10
  end
11
- manifest_hash = Rails.cache.fetch("cdn-asset-#{root_path}-#{asset_name}", expires_in: 5.minutes) do
12
- response = HTTP.get("#{ENV['CDN_URL']}#{assets_path}/rev-manifest.json")
13
- puts "CdnAssetGem INFO: response #{response}"
14
- if response.code == '200'
15
- JSON.parse(response)
16
- else
17
- JSON.parse('{}')
11
+ begin
12
+ puts "CdnAssetGem INFO: file #{file}"
13
+ puts "CdnAssetGem INFO: assets_path #{assets_path}"
14
+ Rails.cache.fetch("cdn-asset-#{root_path}-#{asset_name}", expires_in: 5.minutes) do
15
+ response = HTTP.get("#{ENV['CDN_URL']}#{assets_path}/rev-manifest.json")
16
+ puts "CdnAssetGem INFO: response #{response}"
17
+ "#{ENV['CDN_URL']}#{assets_path}/#{JSON.parse(response)[file]}"
18
18
  end
19
- end
20
- if manifest_hash[file]
21
- "#{ENV['CDN_URL']}#{assets_path}/#{manifest_hash[file]}"
22
- else
19
+ rescue StandardError => e
20
+ puts "CdnAssetGem ERROR: #{e}"
23
21
  "#{ENV['CDN_URL']}#{assets_path}/#{file}"
24
22
  end
25
- rescue
26
- "#{ENV['CDN_URL']}#{assets_path}/#{file}"
27
23
  end
28
24
  end
29
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cdn_asset_gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.16
4
+ version: 1.0.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Baker