jekyll-assets 2.2.5 → 2.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2701c57cfcb5392c562676adbce997cf147cc14c
4
- data.tar.gz: 29041b98a075e176afe6e8fee3f7530ce668de30
3
+ metadata.gz: a1fcdef26bcae20f2b556204dc86af8dce96e1ef
4
+ data.tar.gz: b0c9bd1584b0d25caeff7cd95ddb82f1f8539d9f
5
5
  SHA512:
6
- metadata.gz: 7b1edea77731a82e6db799968a17ebdf910b9cc00ed7b24955a9fac6724c2aff0ec94650e8f416e20ac575a73c6dfaef767040bcfe11612f8e6cce3504858c47
7
- data.tar.gz: c4201b3f5f21352faf4221f528b54d893e8e54361af27c961bc027b0e6cd3205d64275e70f64a2cb4b20765087f00db22ad6b93d449ac385ddc0a98985f4219b
6
+ metadata.gz: 9261a36b91c351729a9b1081b9e40ed786d6e641044ccda49348a36425698220303dffd4d3b388ce31ef49b3aa50c879b612e940586b89d4a47e0a95f770fecf
7
+ data.tar.gz: 792001e489b1e36a4b966d3aca54007583a409dc8cfc6a059606f9098daef896b1d3b7b453aa2ba2ffddde9e48e9a4bec26818485a78c9f92809dd78e0f9818e
@@ -272,8 +272,24 @@ module Jekyll
272
272
  # integrate with the manifest that deeply because it's hard.
273
273
  # --
274
274
  def write_all
275
- assets = manifest.all.partition { |v| v.is_a?(Liquid::Tag::ProxiedAsset) }
276
- manifest.compile(assets.last.map(
275
+ assets = manifest.all.to_a.compact
276
+ if assets.size != manifest.all.size
277
+ Jekyll.logger.error "", "Asset inconsitency, expected "
278
+ "#{manifest.all.size}, can only write #{
279
+ assets.size
280
+ }"
281
+ end
282
+
283
+ assets = manifest.all.group_by do |v|
284
+ v.is_a?(
285
+ Liquid::Tag::ProxiedAsset
286
+ )
287
+ end
288
+
289
+ # These are assets that aren't proxied, they returned fals when
290
+ # they were asked if they belonged to a proxy.
291
+
292
+ manifest.compile(assets[false].map(
277
293
  &:logical_path
278
294
  ))
279
295
 
@@ -282,10 +298,17 @@ module Jekyll
282
298
  # caching, so we always write them individually since they will
283
299
  # never actually show up inside of the manifest.
284
300
 
285
- assets.first.map do |asset|
286
- asset.write_to(jekyll.in_dest_dir(File.join(asset_config["prefix"],
287
- digest?? asset.digest_path : asset.logical_path
288
- )))
301
+ if assets.key?(true)
302
+ unless assets[true].empty?
303
+ Pathutil.new(in_cache_dir)
304
+ .mkdir_p
305
+ end
306
+
307
+ assets[true].map do |asset|
308
+ asset.write_to(jekyll.in_dest_dir(File.join(asset_config["prefix"],
309
+ digest?? asset.digest_path : asset.logical_path
310
+ )))
311
+ end
289
312
  end
290
313
  end
291
314
 
@@ -294,7 +317,9 @@ module Jekyll
294
317
  # --
295
318
  private
296
319
  def strip_path(path)
297
- path.sub(jekyll.in_source_dir("/"), "")
320
+ path.sub(jekyll.in_source_dir("/"),
321
+ ""
322
+ )
298
323
  end
299
324
  end
300
325
  end
@@ -21,5 +21,9 @@ Jekyll::Assets::Hook.register :env, :init do
21
21
  self.cache = begin
22
22
  Sprockets::Cache::MemoryStore.new
23
23
  end
24
+
25
+ else
26
+ Jekyll.logger.info "", "Caching disabled however, " \
27
+ "if you use proxies it could still possibly be created."
24
28
  end
25
29
  end
@@ -37,9 +37,15 @@ module Jekyll
37
37
  # @return [nil]
38
38
  # --
39
39
  def set_integrity
40
+ digest = Sprockets::DigestUtils.integrity_uri(
41
+ Digest::SHA384.digest(
42
+ @asset.to_s
43
+ )
44
+ )
45
+
40
46
  @args.args[:html] ||= {}
41
47
  if @env.asset_config["features"]["integrity"]
42
- @args.args[:html]["integrity"] = @asset.integrity
48
+ @args.args[:html]["integrity"] = digest
43
49
  @args.args[:html]["crossorigin"] = "anonymous" \
44
50
  unless @args.args[:html]["crossorigin"]
45
51
  end
@@ -92,7 +92,7 @@ module Jekyll
92
92
 
93
93
  def to_html
94
94
  (self[:html] || {}).map do |key, val|
95
- %( #{key}="#{val}")
95
+ val == true || val == "true" ? key.to_s : %( #{key}="#{val}")
96
96
  end.join
97
97
  end
98
98
 
@@ -42,10 +42,14 @@ module Jekyll
42
42
  )
43
43
  end
44
44
 
45
+ # --
46
+
45
47
  filenames = []
46
48
  concurrent_compressors = []
47
49
  concurrent_writers = []
48
50
 
51
+ # --
52
+
49
53
  find(*args) do |asset|
50
54
  files[asset.digest_path] = {
51
55
  "mtime" => asset.mtime.iso8601,
@@ -55,15 +59,23 @@ module Jekyll
55
59
  "size" => asset.bytesize
56
60
  }
57
61
 
62
+ # --
63
+
58
64
  assets[asset.logical_path] = asset.digest_path
59
65
  alias_logical_path = self.class.compute_alias_logical_path(
60
66
  asset.logical_path
61
67
  )
62
68
 
69
+ # --
70
+
63
71
  if alias_logical_path
64
72
  assets[alias_logical_path] = asset.digest_path
65
73
  end
66
74
 
75
+ # Unlike upstream, we allow users to disble digesting, this is
76
+ # where we actually and truthfully only diverge from upstream in
77
+ # that we disable or enable the digested or logical path.
78
+
67
79
  target = \
68
80
  if environment.digest?
69
81
  File.join(dir,
@@ -75,16 +87,21 @@ module Jekyll
75
87
  )
76
88
  end
77
89
 
78
- if File.exist?(target)
79
- logger.debug(
80
- "Skipping #{target}, already exists"
81
- )
82
- else
90
+ # --
91
+
92
+ if !environment.digest? || !File.exist?(target)
83
93
  logger.info "Writing #{target}"
84
94
  write_file = Concurrent::Future.execute { asset.write_to target }
85
95
  concurrent_writers << write_file
96
+
97
+ else
98
+ logger.debug(
99
+ "Skipping #{target}, already exists"
100
+ )
86
101
  end
87
102
 
103
+ # --
104
+
88
105
  filenames << asset.filename
89
106
  next if environment.skip_gzip?
90
107
  gzip = Utils::Gzip.new(asset)
@@ -92,6 +109,10 @@ module Jekyll
92
109
  environment.mime_types
93
110
  )
94
111
 
112
+ # This is technically ignored usptream, we don't allow our
113
+ # assets to write `.tar.gz` files by default, however, we leave
114
+ # this here just incase someobody overrides that method.
115
+
95
116
  if File.exist?("#{target}.gz")
96
117
  logger.debug(
97
118
  "Skipping #{target}.gz, already exists"
@@ -107,11 +128,15 @@ module Jekyll
107
128
  end
108
129
  end
109
130
 
131
+ # --
132
+
110
133
  concurrent_writers.each(&:wait!)
111
134
  concurrent_compressors.each(
112
135
  &:wait!
113
136
  )
114
137
 
138
+ # --
139
+
115
140
  save
116
141
  filenames
117
142
  end
@@ -1,19 +1,24 @@
1
- # ----------------------------------------------------------------------------
2
1
  # Frozen-string-literal: true
3
2
  # Copyright: 2012 - 2016 - MIT License
4
3
  # Encoding: utf-8
5
- # ----------------------------------------------------------------------------
6
4
 
7
5
  module Sprockets
8
6
  class Asset
7
+
8
+ # --
9
+ # List all the liquid tags this asset used.
10
+ # --
9
11
  def liquid_tags
10
12
  metadata[:liquid_tags] ||= begin
11
13
  Set.new
12
14
  end
13
15
  end
14
16
 
15
- # ------------------------------------------------------------------------
16
17
 
18
+ # --
19
+ # Pull out the data uri.
20
+ # @return [String]
21
+ # --
17
22
  def data_uri
18
23
  "data:#{content_type};base64,#{Rack::Utils.escape(
19
24
  Base64.encode64(to_s)
@@ -4,6 +4,6 @@
4
4
 
5
5
  module Jekyll
6
6
  module Assets
7
- VERSION="2.2.5"
7
+ VERSION="2.2.6"
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-assets
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.5
4
+ version: 2.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordon Bedwell
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-05-02 00:00:00.000000000 Z
13
+ date: 2016-05-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: sprockets