linner 0.8.6 → 0.8.7

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
  SHA1:
3
- metadata.gz: 99352b6ebaee411dc4b3e454abac2172c0790bb4
4
- data.tar.gz: 776ed095f47910dac7fd30fbf69c6c7ddcb192aa
3
+ metadata.gz: 99ac3be13249f3a3e3ff674538df5b16d45e8b3d
4
+ data.tar.gz: fcb79fcbc3c710833afecb5ba8bb6cbae8558a8f
5
5
  SHA512:
6
- metadata.gz: 24a1c22f3844bf6d1f27c78768eec68810653f2f46a420288cc0c7d57a1ec33ef09dd0e4451a2c0b5e7ae01e685d7dfa851566f47c2cf8f10365e9d1bf74ffd5
7
- data.tar.gz: 57a2aa0b482a0627a9d9a3b603cee02254aa413613365b6a0b8242e06ca049c0f991876c0a879993fa60ca4d49e2ef5e320d297e4e463d7a7f83448e06339263
6
+ metadata.gz: be4eb198984459e6fd569dc6d69bdf01f82ff814d305d2f32549e97b29ea5cc679736ccd25b624d4e0feafbbeea30180b7b20061ae79734d9a1dffa9a10ffb45
7
+ data.tar.gz: 2676fb77d975e4a34f5e3c9cfcdb4f1d310f03769f7207cc5b4f07663966a444641817c8667a3b8bd326f72924bf17148548be9e48c62af22c725a3c5c5f67d1
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ v0.8.7
2
+ - support CDN in revision plugin
3
+
1
4
  v0.8.6
2
5
  - always use binary mode on windows
3
6
 
@@ -107,13 +107,16 @@ Default:
107
107
 
108
108
  ```yaml
109
109
  revision:
110
- prefix: ""
110
+ prefix: "/public"
111
+ cdn: "http://assets.yoursite.com"
111
112
  manifest: "manifest.yml"
112
113
  files:
113
114
  - "index.html"
114
115
  ```
115
116
 
116
- the `prefix` will join with revision hashes, It's useful for CDN support.
117
+ the `prefix` will join with revision hashes.
118
+
119
+ the `cdn` will also join with revision hashes, so it will be like `http://assets.yoursite.com/public/assets/scripts/app.js`.
117
120
 
118
121
  the `manifest` will join with `public` folder, write a manifest file with the name.
119
122
 
@@ -43,6 +43,9 @@ module Linner
43
43
  concat_assets = []
44
44
  template_assets = []
45
45
  sprite_assets = []
46
+ cdn = env.revision["cdn"] || ""
47
+ prefix = env.revision["prefix"] || ""
48
+
46
49
  env.groups.each do |config|
47
50
  concat_assets << config["concat"].keys if config["concat"]
48
51
  template_assets << config["template"].keys if config["template"]
@@ -60,15 +63,14 @@ module Linner
60
63
  name = File.basename(dest).sub /[^.]+\z/, "png"
61
64
  dest = File.join env.sprites["path"], name
62
65
  asset = Asset.new(File.join env.public_folder, dest)
63
- prefix = env.revision["prefix"] || ""
64
- hash[dest] = prefix + asset.relative_digest_path
66
+ hash[prefix + dest] = cdn + prefix + asset.relative_digest_path
65
67
  asset.revision!
66
68
 
67
69
  (concat_assets + copy_assets).flatten.each do |file|
68
70
  path = File.join env.public_folder, file
69
71
  next unless Asset.new(path).stylesheet?
70
72
  url = env.sprites["url"] || env.sprites["path"]
71
- puts = File.read(path).gsub(File.join(url, File.basename(dest)), File.join(prefix, url, File.basename(asset.relative_digest_path)))
73
+ puts = File.read(path).gsub(File.join(url, File.basename(dest)), File.join(cdn, url, File.basename(asset.relative_digest_path)))
72
74
  File.open(path, "w") { |file| file << puts }
73
75
  end
74
76
  end
@@ -76,9 +78,8 @@ module Linner
76
78
  # revision concat template and copy assets
77
79
  (concat_assets + template_assets + copy_assets).flatten.each do |dest|
78
80
  asset = Asset.new(File.join env.public_folder, dest)
79
- prefix = env.revision["prefix"] || ""
80
81
  next unless asset.revable?
81
- hash[dest] = prefix + asset.relative_digest_path
82
+ hash[prefix + dest] = cdn + prefix + asset.relative_digest_path
82
83
  asset.revision!
83
84
  end
84
85
 
@@ -1,3 +1,3 @@
1
1
  module Linner
2
- VERSION = "0.8.6"
2
+ VERSION = "0.8.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.6
4
+ version: 0.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saito