jekyll 4.0.0.pre.alpha1 → 4.1.1
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 +4 -4
- data/.rubocop.yml +58 -17
- data/lib/jekyll.rb +5 -1
- data/lib/jekyll/cache.rb +71 -64
- data/lib/jekyll/cleaner.rb +5 -5
- data/lib/jekyll/collection.rb +6 -4
- data/lib/jekyll/command.rb +4 -2
- data/lib/jekyll/commands/new.rb +4 -4
- data/lib/jekyll/commands/serve.rb +9 -1
- data/lib/jekyll/commands/serve/servlet.rb +13 -14
- data/lib/jekyll/commands/serve/websockets.rb +1 -1
- data/lib/jekyll/configuration.rb +40 -129
- data/lib/jekyll/converters/identity.rb +2 -2
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +70 -9
- data/lib/jekyll/convertible.rb +21 -20
- data/lib/jekyll/document.rb +56 -31
- data/lib/jekyll/drops/document_drop.rb +12 -0
- data/lib/jekyll/drops/drop.rb +14 -8
- data/lib/jekyll/drops/site_drop.rb +11 -1
- data/lib/jekyll/drops/url_drop.rb +52 -1
- data/lib/jekyll/entry_filter.rb +38 -44
- data/lib/jekyll/excerpt.rb +3 -3
- data/lib/jekyll/filters.rb +140 -22
- data/lib/jekyll/filters/url_filters.rb +41 -14
- data/lib/jekyll/frontmatter_defaults.rb +15 -20
- data/lib/jekyll/hooks.rb +2 -5
- data/lib/jekyll/inclusion.rb +32 -0
- data/lib/jekyll/liquid_renderer.rb +18 -15
- data/lib/jekyll/liquid_renderer/file.rb +10 -0
- data/lib/jekyll/liquid_renderer/table.rb +18 -61
- data/lib/jekyll/mime.types +53 -11
- data/lib/jekyll/page.rb +26 -2
- data/lib/jekyll/page_excerpt.rb +25 -0
- data/lib/jekyll/path_manager.rb +31 -0
- data/lib/jekyll/profiler.rb +58 -0
- data/lib/jekyll/reader.rb +4 -1
- data/lib/jekyll/readers/collection_reader.rb +1 -0
- data/lib/jekyll/readers/data_reader.rb +1 -0
- data/lib/jekyll/readers/layout_reader.rb +1 -0
- data/lib/jekyll/readers/page_reader.rb +5 -5
- data/lib/jekyll/readers/post_reader.rb +2 -1
- data/lib/jekyll/readers/static_file_reader.rb +3 -3
- data/lib/jekyll/readers/theme_assets_reader.rb +1 -0
- data/lib/jekyll/renderer.rb +9 -15
- data/lib/jekyll/site.rb +21 -12
- data/lib/jekyll/static_file.rb +15 -10
- data/lib/jekyll/tags/highlight.rb +2 -4
- data/lib/jekyll/tags/include.rb +67 -11
- data/lib/jekyll/tags/post_url.rb +8 -5
- data/lib/jekyll/theme.rb +19 -10
- data/lib/jekyll/url.rb +7 -3
- data/lib/jekyll/utils.rb +14 -18
- data/lib/jekyll/utils/platforms.rb +1 -1
- data/lib/jekyll/utils/win_tz.rb +1 -1
- data/lib/jekyll/version.rb +1 -1
- data/lib/theme_template/theme.gemspec.erb +1 -4
- metadata +33 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b74631944252558b9ad068a1df651f0890577d11c6ac24d06050fe76e9a41d60
|
4
|
+
data.tar.gz: c34826fe92efe4fe968692fa3517c4f8ddf600b9c99af1776d305804e313a1fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d89ea1ca35864a53aa21d21847ef357d33a28f8e094bc4c39bc519c2895ea6e8a87d86669252af4b9431a23634209bf38e909ea7b0686ba22bcac898a43488cc
|
7
|
+
data.tar.gz: 950488593a4b255d8196baf07dfdd04a85bd062cf7b612531b6253eb4118d77ab8209290f535621dd2dc6aec2a73f8079092d243aaa002411e855b6264a5c33a
|
data/.rubocop.yml
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
---
|
2
|
+
inherit_from: .rubocop_todo.yml
|
2
3
|
|
3
4
|
require:
|
5
|
+
- rubocop-performance
|
4
6
|
- ./rubocop/jekyll
|
5
7
|
|
6
8
|
Jekyll/NoPutsAllowed:
|
@@ -8,7 +10,7 @@ Jekyll/NoPutsAllowed:
|
|
8
10
|
- rake/*.rake
|
9
11
|
|
10
12
|
AllCops:
|
11
|
-
TargetRubyVersion: 2.
|
13
|
+
TargetRubyVersion: 2.4
|
12
14
|
Include:
|
13
15
|
- lib/**/*.rb
|
14
16
|
- test/**/*.rb
|
@@ -19,30 +21,53 @@ AllCops:
|
|
19
21
|
- script/**/*
|
20
22
|
- vendor/**/*
|
21
23
|
- tmp/**/*
|
22
|
-
|
24
|
+
|
25
|
+
Layout/EmptyComment:
|
26
|
+
Enabled: false
|
27
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
28
|
+
Enabled: true
|
29
|
+
Layout/EndAlignment:
|
30
|
+
Severity: error
|
31
|
+
Layout/HashAlignment:
|
23
32
|
EnforcedHashRocketStyle: table
|
24
33
|
Layout/IndentationWidth:
|
25
34
|
Severity: error
|
26
|
-
Layout/
|
35
|
+
Layout/FirstArrayElementIndentation:
|
27
36
|
EnforcedStyle: consistent
|
28
|
-
Layout/
|
37
|
+
Layout/FirstHashElementIndentation:
|
29
38
|
EnforcedStyle: consistent
|
39
|
+
Layout/LineLength:
|
40
|
+
Exclude:
|
41
|
+
- !ruby/regexp /features\/.*.rb/
|
42
|
+
- Rakefile
|
43
|
+
- rake/*.rake
|
44
|
+
- Gemfile
|
45
|
+
Max: 100
|
46
|
+
Severity: warning
|
30
47
|
Layout/MultilineMethodCallIndentation:
|
31
48
|
EnforcedStyle: indented
|
32
49
|
Layout/MultilineOperationIndentation:
|
33
50
|
EnforcedStyle: indented
|
51
|
+
Layout/SpaceAroundMethodCallOperator:
|
52
|
+
Enabled: true
|
53
|
+
|
34
54
|
Lint/NestedPercentLiteral:
|
35
55
|
Exclude:
|
36
56
|
- test/test_site.rb
|
37
|
-
|
57
|
+
Lint/DeprecatedOpenSSLConstant:
|
58
|
+
Enabled: true
|
59
|
+
Lint/MixedRegexpCaptureTypes:
|
38
60
|
Enabled: false
|
39
|
-
|
40
|
-
|
61
|
+
Lint/RaiseException:
|
62
|
+
Enabled: true
|
63
|
+
Lint/StructNewOverride:
|
64
|
+
Enabled: true
|
41
65
|
Lint/UnreachableCode:
|
42
66
|
Severity: error
|
43
67
|
Lint/Void:
|
44
68
|
Exclude:
|
45
69
|
- lib/jekyll/site.rb
|
70
|
+
|
46
71
|
Metrics/AbcSize:
|
47
72
|
Max: 21
|
48
73
|
Metrics/BlockLength:
|
@@ -63,24 +88,20 @@ Metrics/CyclomaticComplexity:
|
|
63
88
|
Exclude:
|
64
89
|
- lib/jekyll/utils.rb
|
65
90
|
- lib/jekyll/commands/serve.rb
|
66
|
-
|
67
|
-
Exclude:
|
68
|
-
- !ruby/regexp /features\/.*.rb/
|
69
|
-
- Rakefile
|
70
|
-
- rake/*.rake
|
71
|
-
- Gemfile
|
72
|
-
Max: 100
|
73
|
-
Severity: warning
|
91
|
+
Max: 11
|
74
92
|
Metrics/MethodLength:
|
75
93
|
CountComments: false
|
76
94
|
Max: 20
|
77
95
|
Severity: error
|
78
96
|
Metrics/ModuleLength:
|
79
97
|
Max: 240
|
98
|
+
Exclude:
|
99
|
+
- lib/jekyll/filters.rb
|
80
100
|
Metrics/ParameterLists:
|
81
101
|
Max: 4
|
82
102
|
Metrics/PerceivedComplexity:
|
83
103
|
Max: 8
|
104
|
+
|
84
105
|
Naming/FileName:
|
85
106
|
Enabled: false
|
86
107
|
Naming/HeredocDelimiterNaming:
|
@@ -92,6 +113,7 @@ Naming/MemoizedInstanceVariableName:
|
|
92
113
|
- lib/jekyll/drops/site_drop.rb
|
93
114
|
- lib/jekyll/drops/unified_payload_drop.rb
|
94
115
|
- lib/jekyll/page_without_a_file.rb
|
116
|
+
|
95
117
|
Security/MarshalLoad:
|
96
118
|
Exclude:
|
97
119
|
- !ruby/regexp /test\/.*.rb$/
|
@@ -100,6 +122,7 @@ Security/YAMLLoad:
|
|
100
122
|
Exclude:
|
101
123
|
- !ruby/regexp /features\/.*.rb/
|
102
124
|
- !ruby/regexp /test\/.*.rb$/
|
125
|
+
|
103
126
|
Style/AccessModifierDeclarations:
|
104
127
|
Enabled: false
|
105
128
|
Style/Alias:
|
@@ -109,20 +132,30 @@ Style/AndOr:
|
|
109
132
|
Style/ClassAndModuleChildren:
|
110
133
|
Exclude:
|
111
134
|
- test/**/*.rb
|
112
|
-
Style/FrozenStringLiteralComment:
|
113
|
-
EnforcedStyle: always
|
114
135
|
Style/Documentation:
|
115
136
|
Enabled: false
|
116
137
|
Style/DoubleNegation:
|
117
138
|
Enabled: false
|
139
|
+
Style/ExponentialNotation:
|
140
|
+
Enabled: true
|
118
141
|
Style/FormatStringToken:
|
119
142
|
Exclude:
|
120
143
|
- lib/jekyll/utils/ansi.rb
|
144
|
+
- lib/jekyll/liquid_renderer/table.rb
|
145
|
+
- lib/jekyll/profiler.rb
|
146
|
+
Style/FrozenStringLiteralComment:
|
147
|
+
EnforcedStyle: always
|
121
148
|
Style/GuardClause:
|
122
149
|
Enabled: false
|
150
|
+
Style/HashEachMethods:
|
151
|
+
Enabled: true
|
123
152
|
Style/HashSyntax:
|
124
153
|
EnforcedStyle: hash_rockets
|
125
154
|
Severity: error
|
155
|
+
Style/HashTransformKeys:
|
156
|
+
Enabled: false
|
157
|
+
Style/HashTransformValues:
|
158
|
+
Enabled: true
|
126
159
|
Style/MixinUsage:
|
127
160
|
Exclude:
|
128
161
|
- test/helper.rb
|
@@ -139,6 +172,12 @@ Style/PercentLiteralDelimiters:
|
|
139
172
|
"%w": "()"
|
140
173
|
"%W": "()"
|
141
174
|
"%x": "()"
|
175
|
+
Style/RedundantFetchBlock:
|
176
|
+
Enabled: false
|
177
|
+
Style/RedundantRegexpCharacterClass:
|
178
|
+
Enabled: true
|
179
|
+
Style/RedundantRegexpEscape:
|
180
|
+
Enabled: true
|
142
181
|
Style/RegexpLiteral:
|
143
182
|
EnforcedStyle: percent_r
|
144
183
|
Style/RescueModifier:
|
@@ -148,6 +187,8 @@ Style/SafeNavigation:
|
|
148
187
|
- lib/jekyll/document.rb
|
149
188
|
Style/SignalException:
|
150
189
|
EnforcedStyle: only_raise
|
190
|
+
Style/SlicingWithRange:
|
191
|
+
Enabled: false
|
151
192
|
Style/StringLiterals:
|
152
193
|
EnforcedStyle: double_quotes
|
153
194
|
Style/StringLiteralsInInterpolation:
|
data/lib/jekyll.rb
CHANGED
@@ -50,10 +50,12 @@ module Jekyll
|
|
50
50
|
autoload :EntryFilter, "jekyll/entry_filter"
|
51
51
|
autoload :Errors, "jekyll/errors"
|
52
52
|
autoload :Excerpt, "jekyll/excerpt"
|
53
|
+
autoload :PageExcerpt, "jekyll/page_excerpt"
|
53
54
|
autoload :External, "jekyll/external"
|
54
55
|
autoload :FrontmatterDefaults, "jekyll/frontmatter_defaults"
|
55
56
|
autoload :Hooks, "jekyll/hooks"
|
56
57
|
autoload :Layout, "jekyll/layout"
|
58
|
+
autoload :Inclusion, "jekyll/inclusion"
|
57
59
|
autoload :Cache, "jekyll/cache"
|
58
60
|
autoload :CollectionReader, "jekyll/readers/collection_reader"
|
59
61
|
autoload :DataReader, "jekyll/readers/data_reader"
|
@@ -65,8 +67,10 @@ module Jekyll
|
|
65
67
|
autoload :LogAdapter, "jekyll/log_adapter"
|
66
68
|
autoload :Page, "jekyll/page"
|
67
69
|
autoload :PageWithoutAFile, "jekyll/page_without_a_file"
|
70
|
+
autoload :PathManager, "jekyll/path_manager"
|
68
71
|
autoload :PluginManager, "jekyll/plugin_manager"
|
69
72
|
autoload :Publisher, "jekyll/publisher"
|
73
|
+
autoload :Profiler, "jekyll/profiler"
|
70
74
|
autoload :Reader, "jekyll/reader"
|
71
75
|
autoload :Regenerator, "jekyll/regenerator"
|
72
76
|
autoload :RelatedPosts, "jekyll/related_posts"
|
@@ -189,7 +193,7 @@ module Jekyll
|
|
189
193
|
end
|
190
194
|
|
191
195
|
# Conditional optimizations
|
192
|
-
Jekyll::External.require_if_present("liquid
|
196
|
+
Jekyll::External.require_if_present("liquid/c")
|
193
197
|
end
|
194
198
|
end
|
195
199
|
|
data/lib/jekyll/cache.rb
CHANGED
@@ -4,9 +4,59 @@ require "digest"
|
|
4
4
|
|
5
5
|
module Jekyll
|
6
6
|
class Cache
|
7
|
-
#
|
8
|
-
|
9
|
-
|
7
|
+
# class-wide base cache
|
8
|
+
@base_cache = {}
|
9
|
+
|
10
|
+
# class-wide directive to write cache to disk is enabled by default
|
11
|
+
@disk_cache_enabled = true
|
12
|
+
|
13
|
+
class << self
|
14
|
+
# class-wide cache location
|
15
|
+
attr_accessor :cache_dir
|
16
|
+
|
17
|
+
# class-wide directive to write cache to disk
|
18
|
+
attr_reader :disk_cache_enabled
|
19
|
+
|
20
|
+
# class-wide base cache reader
|
21
|
+
attr_reader :base_cache
|
22
|
+
|
23
|
+
# Disable Marshaling cached items to disk
|
24
|
+
def disable_disk_cache!
|
25
|
+
@disk_cache_enabled = false
|
26
|
+
end
|
27
|
+
|
28
|
+
# Clear all caches
|
29
|
+
def clear
|
30
|
+
delete_cache_files
|
31
|
+
base_cache.each_value(&:clear)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Compare the current config to the cached config
|
35
|
+
# If they are different, clear all caches
|
36
|
+
#
|
37
|
+
# Returns nothing.
|
38
|
+
def clear_if_config_changed(config)
|
39
|
+
config = config.inspect
|
40
|
+
cache = Jekyll::Cache.new "Jekyll::Cache"
|
41
|
+
return if cache.key?("config") && cache["config"] == config
|
42
|
+
|
43
|
+
clear
|
44
|
+
cache = Jekyll::Cache.new "Jekyll::Cache"
|
45
|
+
cache["config"] = config
|
46
|
+
nil
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
# Delete all cached items from all caches
|
52
|
+
#
|
53
|
+
# Returns nothing.
|
54
|
+
def delete_cache_files
|
55
|
+
FileUtils.rm_rf(@cache_dir) if disk_cache_enabled
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
#
|
10
60
|
|
11
61
|
# Get an existing named cache, or create a new one if none exists
|
12
62
|
#
|
@@ -14,27 +64,10 @@ module Jekyll
|
|
14
64
|
#
|
15
65
|
# Returns nothing.
|
16
66
|
def initialize(name)
|
17
|
-
@cache =
|
67
|
+
@cache = Jekyll::Cache.base_cache[name] ||= {}
|
18
68
|
@name = name.gsub(%r![^\w\s-]!, "-")
|
19
69
|
end
|
20
70
|
|
21
|
-
# Set class-wide base_dir
|
22
|
-
def self.base_dir=(dir_path)
|
23
|
-
@@base_dir = dir_path
|
24
|
-
end
|
25
|
-
|
26
|
-
# Disable Marshaling cached items to disk
|
27
|
-
def self.disable_disk_cache!
|
28
|
-
@@disk_cache_enabled = false
|
29
|
-
end
|
30
|
-
# rubocop:enable Style/ClassVars
|
31
|
-
|
32
|
-
# Clear all caches
|
33
|
-
def self.clear
|
34
|
-
delete_cache_files
|
35
|
-
@@caches.each_value(&:clear)
|
36
|
-
end
|
37
|
-
|
38
71
|
# Clear this particular cache
|
39
72
|
def clear
|
40
73
|
delete_cache_files
|
@@ -49,7 +82,7 @@ module Jekyll
|
|
49
82
|
return @cache[key] if @cache.key?(key)
|
50
83
|
|
51
84
|
path = path_to(hash(key))
|
52
|
-
if
|
85
|
+
if disk_cache_enabled? && File.file?(path) && File.readable?(path)
|
53
86
|
@cache[key] = load(path)
|
54
87
|
else
|
55
88
|
raise
|
@@ -61,7 +94,7 @@ module Jekyll
|
|
61
94
|
# Returns nothing.
|
62
95
|
def []=(key, value)
|
63
96
|
@cache[key] = value
|
64
|
-
return unless
|
97
|
+
return unless disk_cache_enabled?
|
65
98
|
|
66
99
|
path = path_to(hash(key))
|
67
100
|
value = new Hash(value) if value.is_a?(Hash) && !value.default.nil?
|
@@ -70,9 +103,8 @@ module Jekyll
|
|
70
103
|
Jekyll.logger.debug "Cache:", "Cannot dump object #{key}"
|
71
104
|
end
|
72
105
|
|
73
|
-
# If an item already exists in the cache, retrieve it
|
74
|
-
# Else execute code block, and add the result to the cache, and return that
|
75
|
-
# result
|
106
|
+
# If an item already exists in the cache, retrieve it.
|
107
|
+
# Else execute code block, and add the result to the cache, and return that result.
|
76
108
|
def getset(key)
|
77
109
|
self[key]
|
78
110
|
rescue StandardError
|
@@ -86,10 +118,7 @@ module Jekyll
|
|
86
118
|
# Returns nothing.
|
87
119
|
def delete(key)
|
88
120
|
@cache.delete(key)
|
89
|
-
|
90
|
-
|
91
|
-
path = path_to(hash(key))
|
92
|
-
File.delete(path)
|
121
|
+
File.delete(path_to(hash(key))) if disk_cache_enabled?
|
93
122
|
end
|
94
123
|
|
95
124
|
# Check if `key` already exists in this cache
|
@@ -100,40 +129,27 @@ module Jekyll
|
|
100
129
|
return true if @cache.key?(key)
|
101
130
|
# Otherwise, it might be cached on disk
|
102
131
|
# but we should not consider the disk cache if it is disabled
|
103
|
-
return false unless
|
132
|
+
return false unless disk_cache_enabled?
|
104
133
|
|
105
134
|
path = path_to(hash(key))
|
106
135
|
File.file?(path) && File.readable?(path)
|
107
136
|
end
|
108
137
|
|
109
|
-
|
110
|
-
|
111
|
-
#
|
112
|
-
# Returns nothing.
|
113
|
-
def self.clear_if_config_changed(config)
|
114
|
-
config = config.inspect
|
115
|
-
cache = Jekyll::Cache.new "Jekyll::Cache"
|
116
|
-
return if cache.key?("config") && cache["config"] == config
|
117
|
-
|
118
|
-
clear
|
119
|
-
cache = Jekyll::Cache.new "Jekyll::Cache"
|
120
|
-
cache["config"] = config
|
121
|
-
nil
|
138
|
+
def disk_cache_enabled?
|
139
|
+
!!Jekyll::Cache.disk_cache_enabled
|
122
140
|
end
|
123
141
|
|
124
142
|
private
|
125
143
|
|
126
|
-
# Given a hashed key, return the path to where this item would be saved on
|
127
|
-
# disk
|
144
|
+
# Given a hashed key, return the path to where this item would be saved on disk.
|
128
145
|
def path_to(hash = nil)
|
129
|
-
@base_dir ||= File.join(
|
146
|
+
@base_dir ||= File.join(Jekyll::Cache.cache_dir, @name)
|
130
147
|
return @base_dir if hash.nil?
|
131
148
|
|
132
149
|
File.join(@base_dir, hash[0..1], hash[2..-1]).freeze
|
133
150
|
end
|
134
151
|
|
135
|
-
# Given a key, return a SHA2 hash that can be used for caching this item to
|
136
|
-
# disk
|
152
|
+
# Given a key, return a SHA2 hash that can be used for caching this item to disk.
|
137
153
|
def hash(key)
|
138
154
|
Digest::SHA2.hexdigest(key).freeze
|
139
155
|
end
|
@@ -142,22 +158,14 @@ module Jekyll
|
|
142
158
|
#
|
143
159
|
# Returns nothing.
|
144
160
|
def delete_cache_files
|
145
|
-
FileUtils.rm_rf(path_to) if
|
146
|
-
end
|
147
|
-
|
148
|
-
# Delete all cached items from all caches
|
149
|
-
#
|
150
|
-
# Returns nothing.
|
151
|
-
def self.delete_cache_files
|
152
|
-
FileUtils.rm_rf(@@base_dir) if @@disk_cache_enabled
|
161
|
+
FileUtils.rm_rf(path_to) if disk_cache_enabled?
|
153
162
|
end
|
154
|
-
private_class_method :delete_cache_files
|
155
163
|
|
156
|
-
# Load `path` from disk and return the result
|
164
|
+
# Load `path` from disk and return the result.
|
157
165
|
# This MUST NEVER be called in Safe Mode
|
158
166
|
# rubocop:disable Security/MarshalLoad
|
159
167
|
def load(path)
|
160
|
-
raise unless
|
168
|
+
raise unless disk_cache_enabled?
|
161
169
|
|
162
170
|
cached_file = File.open(path, "rb")
|
163
171
|
value = Marshal.load(cached_file)
|
@@ -166,15 +174,14 @@ module Jekyll
|
|
166
174
|
end
|
167
175
|
# rubocop:enable Security/MarshalLoad
|
168
176
|
|
169
|
-
# Given a path and a value, save value to disk at path
|
177
|
+
# Given a path and a value, save value to disk at path.
|
170
178
|
# This should NEVER be called in Safe Mode
|
171
179
|
#
|
172
180
|
# Returns nothing.
|
173
181
|
def dump(path, value)
|
174
|
-
return unless
|
182
|
+
return unless disk_cache_enabled?
|
175
183
|
|
176
|
-
|
177
|
-
FileUtils.mkdir_p(dir)
|
184
|
+
FileUtils.mkdir_p(File.dirname(path))
|
178
185
|
File.open(path, "wb") do |cached_file|
|
179
186
|
Marshal.dump(value, cached_file)
|
180
187
|
end
|
data/lib/jekyll/cleaner.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
module Jekyll
|
4
4
|
# Handles the cleanup of a site's destination before it is built.
|
5
5
|
class Cleaner
|
6
|
-
HIDDEN_FILE_REGEX = %r
|
6
|
+
HIDDEN_FILE_REGEX = %r!/\.{1,2}$!.freeze
|
7
7
|
attr_reader :site
|
8
8
|
|
9
9
|
def initialize(site)
|
@@ -66,7 +66,7 @@ module Jekyll
|
|
66
66
|
#
|
67
67
|
# Returns a Set with the directory paths
|
68
68
|
def new_dirs
|
69
|
-
@new_dirs ||= new_files.
|
69
|
+
@new_dirs ||= new_files.flat_map { |file| parent_dirs(file) }.to_set
|
70
70
|
end
|
71
71
|
|
72
72
|
# Private: The list of parent directories of a given file
|
@@ -77,7 +77,7 @@ module Jekyll
|
|
77
77
|
if parent_dir == site.dest
|
78
78
|
[]
|
79
79
|
else
|
80
|
-
|
80
|
+
parent_dirs(parent_dir).unshift(parent_dir)
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
@@ -94,7 +94,7 @@ module Jekyll
|
|
94
94
|
#
|
95
95
|
# Returns a Set with the directory paths
|
96
96
|
def keep_dirs
|
97
|
-
site.keep_files.
|
97
|
+
site.keep_files.flat_map { |file| parent_dirs(site.in_dest_dir(file)) }.to_set
|
98
98
|
end
|
99
99
|
|
100
100
|
# Private: Creates a regular expression from the config's keep_files array
|
@@ -105,7 +105,7 @@ module Jekyll
|
|
105
105
|
#
|
106
106
|
# Returns the regular expression
|
107
107
|
def keep_file_regex
|
108
|
-
%r!\A#{Regexp.quote(site.dest)}
|
108
|
+
%r!\A#{Regexp.quote(site.dest)}/(#{Regexp.union(site.keep_files).source})!
|
109
109
|
end
|
110
110
|
end
|
111
111
|
end
|