jekyll-assets 2.0.3 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +13 -9
- data/README.md +36 -10
- data/Rakefile +40 -0
- data/lib/jekyll/assets.rb +13 -10
- data/lib/jekyll/assets/addons.rb +7 -6
- data/lib/jekyll/assets/addons/processors/liquid.rb +31 -0
- data/lib/jekyll/assets/addons/proxies/magick.rb +10 -8
- data/lib/jekyll/assets/config.rb +11 -8
- data/lib/jekyll/assets/env.rb +33 -17
- data/lib/jekyll/assets/hook.rb +17 -18
- data/lib/jekyll/assets/hooks.rb +13 -14
- data/lib/jekyll/assets/hooks/context_patches.rb +2 -2
- data/lib/jekyll/assets/hooks/helpers.rb +1 -1
- data/lib/jekyll/assets/hooks/jekyll/{asset_drops.rb → drops.rb} +1 -1
- data/lib/jekyll/assets/hooks/jekyll/setup.rb +13 -0
- data/lib/jekyll/assets/hooks/jekyll/{write_assets.rb → write.rb} +0 -0
- data/lib/jekyll/assets/hooks/sources.rb +2 -1
- data/lib/jekyll/assets/liquid.rb +3 -3
- data/lib/jekyll/assets/liquid/drop.rb +3 -3
- data/lib/jekyll/assets/liquid/filters.rb +5 -12
- data/lib/jekyll/assets/liquid/tag.rb +31 -37
- data/lib/jekyll/assets/liquid/tag/defaults.rb +2 -3
- data/lib/jekyll/assets/liquid/tag/defaults/image.rb +5 -5
- data/lib/jekyll/assets/liquid/tag/parser.rb +47 -55
- data/lib/jekyll/assets/liquid/tag/proxied_asset.rb +6 -10
- data/lib/jekyll/assets/liquid/tag/proxies.rb +19 -32
- data/lib/jekyll/assets/logger.rb +7 -6
- data/lib/jekyll/assets/patches.rb +4 -4
- data/lib/jekyll/assets/patches/kernel.rb +1 -1
- data/lib/jekyll/assets/version.rb +1 -1
- metadata +14 -14
- data/lib/jekyll/assets/hooks/jekyll/ignore.rb +0 -9
- data/lib/jekyll/assets/hooks/jekyll/initialize.rb +0 -7
@@ -2,8 +2,6 @@
|
|
2
2
|
# Copyright: 2012-2015 - MIT License
|
3
3
|
# Encoding: utf-8
|
4
4
|
|
5
|
-
require "forwardable"
|
6
|
-
|
7
5
|
module Jekyll
|
8
6
|
module Assets
|
9
7
|
module Liquid
|
@@ -61,10 +59,9 @@ module Jekyll
|
|
61
59
|
#
|
62
60
|
|
63
61
|
def digest_path
|
64
|
-
name = asset.logical_path
|
65
|
-
|
66
|
-
|
67
|
-
}"
|
62
|
+
name = asset.logical_path
|
63
|
+
ext = File.extname(name)
|
64
|
+
"#{File.basename(name, ext)}-#{digest}#{ext}"
|
68
65
|
end
|
69
66
|
|
70
67
|
#
|
@@ -88,10 +85,9 @@ module Jekyll
|
|
88
85
|
|
89
86
|
private
|
90
87
|
def cache_file
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
end
|
88
|
+
@_cached = File.file?(filename)
|
89
|
+
FileUtils.cp asset.filename, filename unless @_cached
|
90
|
+
@_cached
|
95
91
|
end
|
96
92
|
end
|
97
93
|
end
|
@@ -7,18 +7,16 @@ module Jekyll
|
|
7
7
|
module Liquid
|
8
8
|
class Tag
|
9
9
|
module Proxies
|
10
|
-
def self.add_by_class(
|
11
|
-
|
12
|
-
tags = [tag].flatten.map { |v| [v.to_s, v, v.to_sym] }
|
13
|
-
args = [args].flatten.map { |v| [v.to_s, v, v.to_sym] }
|
14
|
-
|
10
|
+
def self.add_by_class(class_, name, tag, *args)
|
11
|
+
proc_ = proc { |v| [v.to_s, v, v.to_sym] }
|
15
12
|
all << {
|
16
|
-
:name =>
|
17
|
-
:
|
18
|
-
:
|
19
|
-
:class =>
|
13
|
+
:name => proc_.call(name).uniq,
|
14
|
+
:args => [args].flatten.map(&proc_).flatten.uniq,
|
15
|
+
:tags => [ tag].flatten.map(&proc_).flatten.uniq,
|
16
|
+
:class => class_
|
20
17
|
}
|
21
|
-
|
18
|
+
|
19
|
+
all
|
22
20
|
end
|
23
21
|
|
24
22
|
#
|
@@ -32,8 +30,7 @@ module Jekyll
|
|
32
30
|
def self.keys
|
33
31
|
all.select { |val| !val[:class].is_a?(Symbol) }.map do |val|
|
34
32
|
val[:name]
|
35
|
-
end.
|
36
|
-
flatten
|
33
|
+
end.flatten
|
37
34
|
end
|
38
35
|
|
39
36
|
#
|
@@ -41,8 +38,7 @@ module Jekyll
|
|
41
38
|
def self.base_keys
|
42
39
|
all.select { |val| val[:class].is_a?(Symbol) }.map do |val|
|
43
40
|
val[:name]
|
44
|
-
end.
|
45
|
-
flatten
|
41
|
+
end.flatten
|
46
42
|
end
|
47
43
|
|
48
44
|
#
|
@@ -54,15 +50,9 @@ module Jekyll
|
|
54
50
|
#
|
55
51
|
|
56
52
|
def self.get(name, tag = nil, arg = nil)
|
57
|
-
if name && tag && arg
|
58
|
-
get_by_name_and_tag_and_arg(
|
59
|
-
name, tag, arg
|
60
|
-
)
|
61
|
-
|
53
|
+
if name && tag && arg then get_by_name_and_tag_and_arg(name, tag, arg)
|
62
54
|
elsif name && tag
|
63
|
-
get_by_name_and_tag(
|
64
|
-
name, tag
|
65
|
-
)
|
55
|
+
get_by_name_and_tag(name, tag)
|
66
56
|
|
67
57
|
else
|
68
58
|
all.select do |val|
|
@@ -75,10 +65,8 @@ module Jekyll
|
|
75
65
|
|
76
66
|
def self.get_by_name_and_tag_and_arg(name, tag, arg)
|
77
67
|
all.select do |val|
|
78
|
-
|
79
|
-
|
80
|
-
val[:tags].include?(tag)) && \
|
81
|
-
(val[:args].include?( arg))
|
68
|
+
val[:name].include?(name) && (val[:tags].include?(:all) || val[:tags] \
|
69
|
+
.include?(tag)) && val[:args].include?(arg)
|
82
70
|
end
|
83
71
|
end
|
84
72
|
|
@@ -86,9 +74,8 @@ module Jekyll
|
|
86
74
|
|
87
75
|
def self.get_by_name_and_tag(name, tag)
|
88
76
|
all.select do |val|
|
89
|
-
|
90
|
-
|
91
|
-
val[:tags].include?(tag))
|
77
|
+
val[:name].include?(name) && (val[:tags].include?(:all) || val[:tags] \
|
78
|
+
.include?(tag))
|
92
79
|
end
|
93
80
|
end
|
94
81
|
|
@@ -102,9 +89,9 @@ module Jekyll
|
|
102
89
|
|
103
90
|
private
|
104
91
|
def self.generate_class(name, tag, &block)
|
105
|
-
|
106
|
-
|
107
|
-
return
|
92
|
+
class_ = const_set(random_name, Class.new)
|
93
|
+
class_.class_eval(&block)
|
94
|
+
return class_, name, tag
|
108
95
|
end
|
109
96
|
|
110
97
|
#
|
data/lib/jekyll/assets/logger.rb
CHANGED
@@ -5,7 +5,8 @@
|
|
5
5
|
module Jekyll
|
6
6
|
module Assets
|
7
7
|
class Logger
|
8
|
-
|
8
|
+
PREFIX = "Jekyll Assets:"
|
9
|
+
|
9
10
|
def log
|
10
11
|
@_log ||= Jekyll.logger
|
11
12
|
end
|
@@ -14,33 +15,33 @@ module Jekyll
|
|
14
15
|
|
15
16
|
def warn(msg = nil, &block)
|
16
17
|
msg = (block_given?? block.call : msg)
|
17
|
-
log.warn(
|
18
|
+
log.warn(PREFIX, msg)
|
18
19
|
end
|
19
20
|
|
20
21
|
# Log Level: 1
|
21
22
|
|
22
23
|
def error(msg = nil, &block)
|
23
24
|
msg = (block_given?? block.call : msg)
|
24
|
-
log.error(
|
25
|
+
log.error(PREFIX, msg)
|
25
26
|
end
|
26
27
|
|
27
28
|
# Log Level: 2
|
28
29
|
|
29
30
|
def info(msg = nil, &block)
|
30
31
|
msg = (block_given?? block.call : msg)
|
31
|
-
log.info(
|
32
|
+
log.info(PREFIX, msg)
|
32
33
|
end
|
33
34
|
|
34
35
|
# Log Level: 3
|
35
36
|
|
36
37
|
def debug(msg = nil, &block)
|
37
38
|
msg = (block_given?? block.call : msg)
|
38
|
-
log.debug(
|
39
|
+
log.debug(PREFIX, msg)
|
39
40
|
end
|
40
41
|
|
41
42
|
#
|
42
43
|
|
43
|
-
def log_level=(*
|
44
|
+
def log_level=(*)
|
44
45
|
raise RuntimeError, "Please set log levels on Jekyll.logger"
|
45
46
|
end
|
46
47
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# Copyright: 2012-2015 - MIT License
|
3
3
|
# Encoding: utf-8
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
require "jekyll/assets/patches/jekyll/cleaner"
|
6
|
+
require "jekyll/assets/patches/sprockets/asset"
|
7
|
+
require "jekyll/assets/patches/jekyll/site"
|
8
|
+
require "jekyll/assets/patches/kernel"
|
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.0
|
4
|
+
version: 2.1.0
|
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: 2015-
|
13
|
+
date: 2015-12-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: sprockets
|
@@ -69,33 +69,33 @@ dependencies:
|
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '3.0'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
72
|
+
name: tilt
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
74
74
|
requirements:
|
75
75
|
- - "~>"
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
78
|
-
type: :
|
77
|
+
version: '2.0'
|
78
|
+
type: :runtime
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - "~>"
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: '
|
84
|
+
version: '2.0'
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
|
-
name:
|
86
|
+
name: nokogiri
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
89
|
- - "~>"
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version: '1.
|
91
|
+
version: '1.6'
|
92
92
|
type: :development
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
96
|
- - "~>"
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: '1.
|
98
|
+
version: '1.6'
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
100
|
name: luna-rspec-formatters
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- lib/jekyll/assets/addons/compass.rb
|
149
149
|
- lib/jekyll/assets/addons/font_awesome.rb
|
150
150
|
- lib/jekyll/assets/addons/js_es6.rb
|
151
|
+
- lib/jekyll/assets/addons/processors/liquid.rb
|
151
152
|
- lib/jekyll/assets/addons/proxies/magick.rb
|
152
153
|
- lib/jekyll/assets/cached.rb
|
153
154
|
- lib/jekyll/assets/config.rb
|
@@ -160,10 +161,9 @@ files:
|
|
160
161
|
- lib/jekyll/assets/hooks/context_patches.rb
|
161
162
|
- lib/jekyll/assets/hooks/disable_erb.rb
|
162
163
|
- lib/jekyll/assets/hooks/helpers.rb
|
163
|
-
- lib/jekyll/assets/hooks/jekyll/
|
164
|
-
- lib/jekyll/assets/hooks/jekyll/
|
165
|
-
- lib/jekyll/assets/hooks/jekyll/
|
166
|
-
- lib/jekyll/assets/hooks/jekyll/write_assets.rb
|
164
|
+
- lib/jekyll/assets/hooks/jekyll/drops.rb
|
165
|
+
- lib/jekyll/assets/hooks/jekyll/setup.rb
|
166
|
+
- lib/jekyll/assets/hooks/jekyll/write.rb
|
167
167
|
- lib/jekyll/assets/hooks/logger.rb
|
168
168
|
- lib/jekyll/assets/hooks/sources.rb
|
169
169
|
- lib/jekyll/assets/hooks/sprockets.rb
|
@@ -204,7 +204,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
204
|
version: '0'
|
205
205
|
requirements: []
|
206
206
|
rubyforge_project:
|
207
|
-
rubygems_version: 2.
|
207
|
+
rubygems_version: 2.5.0
|
208
208
|
signing_key:
|
209
209
|
specification_version: 4
|
210
210
|
summary: Assets for Jekyll
|
@@ -1,9 +0,0 @@
|
|
1
|
-
# Frozen-string-literal: true
|
2
|
-
# Copyright: 2012-2015 - MIT License
|
3
|
-
# Encoding: utf-8
|
4
|
-
|
5
|
-
Jekyll::Hooks.register :site, :after_reset do |jekyll|
|
6
|
-
unless jekyll.config["exclude"].grep(/\A\.asset\-cache\/?/).size > 0
|
7
|
-
jekyll.config["exclude"].push(".asset-cache/")
|
8
|
-
end
|
9
|
-
end
|