jekyll 4.0.0.pre.alpha1 → 4.0.0.pre.beta1

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: 1510de5e88a3e6d48fa5eb7686dfafc1cf94b820cd9b44fdd635bff9c306d98b
4
- data.tar.gz: e4f444b21baf087d33f3dd7040c17b2fa00f5ed4a32f3602ee26722d4270ebc3
3
+ metadata.gz: 557bf944b97df515f8ac16b41b21317a4361fa27e45c44d63ea8579e14a8188e
4
+ data.tar.gz: 436685ee32413cf98111372ca82f1f39d38f549cc2cf482c86a1aba53e627b93
5
5
  SHA512:
6
- metadata.gz: 854691fcc3090fe0292767b7aaa5c20504d5d11c08c9f301398cc5af70d387c002ad804fdf20a1583ab4a93d326425aff205b89554860c6babb84f6154923b85
7
- data.tar.gz: ef22dd4eea32776ef7f25748241f1236431b8fd566bb377d8d66a657ade71e5de836ea149f7c7e0ff3483f471e8da801915261c6e0a110e97a43970707b3b05c
6
+ metadata.gz: 76c7cfa113e1a0741584a34be45ed4380e57250d1829d905d4aa1bba33ec06d6e1debf02a474ab36aca8f65ff1f4fca9cb97ce06c52e74715327267bb2bb5345
7
+ data.tar.gz: 4f25d89074b8aae2dfdcad4a56246b7541137e5a226040898e13b0f610acce79e8d8aaee0c63ea7aae185d09156b85643269440d6a02bc59dac8e2d26033e4af
@@ -1,6 +1,7 @@
1
1
  ---
2
2
 
3
3
  require:
4
+ - rubocop-performance
4
5
  - ./rubocop/jekyll
5
6
 
6
7
  Jekyll/NoPutsAllowed:
@@ -8,7 +9,7 @@ Jekyll/NoPutsAllowed:
8
9
  - rake/*.rake
9
10
 
10
11
  AllCops:
11
- TargetRubyVersion: 2.3
12
+ TargetRubyVersion: 2.4
12
13
  Include:
13
14
  - lib/**/*.rb
14
15
  - test/**/*.rb
@@ -23,9 +24,9 @@ Layout/AlignHash:
23
24
  EnforcedHashRocketStyle: table
24
25
  Layout/IndentationWidth:
25
26
  Severity: error
26
- Layout/IndentArray:
27
+ Layout/IndentFirstArrayElement:
27
28
  EnforcedStyle: consistent
28
- Layout/IndentHash:
29
+ Layout/IndentFirstHashElement:
29
30
  EnforcedStyle: consistent
30
31
  Layout/MultilineMethodCallIndentation:
31
32
  EnforcedStyle: indented
@@ -65,6 +65,7 @@ module Jekyll
65
65
  autoload :LogAdapter, "jekyll/log_adapter"
66
66
  autoload :Page, "jekyll/page"
67
67
  autoload :PageWithoutAFile, "jekyll/page_without_a_file"
68
+ autoload :PathManager, "jekyll/path_manager"
68
69
  autoload :PluginManager, "jekyll/plugin_manager"
69
70
  autoload :Publisher, "jekyll/publisher"
70
71
  autoload :Reader, "jekyll/reader"
@@ -4,9 +4,59 @@ require "digest"
4
4
 
5
5
  module Jekyll
6
6
  class Cache
7
- # rubocop:disable Style/ClassVars
8
- @@caches = {}
9
- @@disk_cache_enabled = true
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 = @@caches[name] ||= {}
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 @@disk_cache_enabled && File.file?(path) && File.readable?(path)
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 @@disk_cache_enabled
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
- return unless @@disk_cache_enabled
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 @@disk_cache_enabled
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
- # Compare the current config to the cached config
110
- # If they are different, clear all caches
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(@@base_dir, @name)
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 @@disk_cache_enabled
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 @@disk_cache_enabled
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 @@disk_cache_enabled
182
+ return unless disk_cache_enabled?
175
183
 
176
- dir = File.dirname(path)
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
@@ -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.map { |file| parent_dirs(file) }.flatten.to_set
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
- [parent_dir] + parent_dirs(parent_dir)
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.map { |file| parent_dirs(site.in_dest_dir(file)) }.flatten.to_set
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
@@ -75,11 +75,13 @@ module Jekyll
75
75
  def entries
76
76
  return [] unless exists?
77
77
 
78
- @entries ||=
78
+ @entries ||= begin
79
+ collection_dir_slash = "#{collection_dir}/"
79
80
  Utils.safe_glob(collection_dir, ["**", "*"], File::FNM_DOTMATCH).map do |entry|
80
- entry["#{collection_dir}/"] = ""
81
+ entry[collection_dir_slash] = ""
81
82
  entry
82
83
  end
84
+ end
83
85
  end
84
86
 
85
87
  # Filtered version of the entries in this collection.
@@ -29,15 +29,15 @@ module Jekyll
29
29
  end
30
30
 
31
31
  def inline?
32
- @response["Content-Disposition"] =~ %r!^inline!
32
+ @response["Content-Disposition"].to_s.start_with?("inline")
33
33
  end
34
34
 
35
35
  def bad_browser?
36
- BAD_USER_AGENTS.any? { |pattern| @request["User-Agent"] =~ pattern }
36
+ BAD_USER_AGENTS.any? { |pattern| pattern.match?(@request["User-Agent"]) }
37
37
  end
38
38
 
39
39
  def html?
40
- @response["Content-Type"] =~ %r!text/html!
40
+ @response["Content-Type"].to_s.include?("text/html")
41
41
  end
42
42
  end
43
43
 
@@ -98,17 +98,16 @@ module Jekyll
98
98
  # Complicated JavaScript to ensure that livereload.js is loaded from the
99
99
  # same origin as the page. Mostly useful for dealing with the browser's
100
100
  # distinction between 'localhost' and 127.0.0.1
101
- template = <<-TEMPLATE
102
- <script>
103
- document.write(
104
- '<script src="http://' +
105
- (location.host || 'localhost').split(':')[0] +
106
- ':<%=@options["livereload_port"] %>/livereload.js?snipver=1<%= livereload_args %>"' +
107
- '></' +
108
- 'script>');
109
- </script>
101
+ @template ||= ERB.new(<<~TEMPLATE)
102
+ <script>
103
+ document.write(
104
+ '<script src="http://' +
105
+ (location.host || 'localhost').split(':')[0] +
106
+ ':<%=@options["livereload_port"] %>/livereload.js?snipver=1<%= livereload_args %>"' +
107
+ '></' +
108
+ 'script>');
109
+ </script>
110
110
  TEMPLATE
111
- ERB.new(Jekyll::Utils.strip_heredoc(template))
112
111
  end
113
112
 
114
113
  def livereload_args
@@ -186,7 +185,7 @@ module Jekyll
186
185
  key = res.header.keys.grep(%r!content-type!i).first
187
186
  typ = res.header[key]
188
187
 
189
- unless typ =~ %r!;\s*charset=!
188
+ unless %r!;\s*charset=!.match?(typ)
190
189
  res.header[key] = "#{typ}; charset=#{@jekyll_opts["encoding"]}"
191
190
  end
192
191
  end
@@ -46,7 +46,7 @@ module Jekyll
46
46
  # WebSockets requests will have a Connection: Upgrade header
47
47
  if parser.http_method != "GET" || parser.upgrade?
48
48
  super
49
- elsif parser.request_url =~ %r!^\/livereload.js!
49
+ elsif parser.request_url.start_with?("/livereload.js")
50
50
  headers = [
51
51
  "HTTP/1.1 200 OK",
52
52
  "Content-Type: application/javascript",
@@ -79,15 +79,11 @@ module Jekyll
79
79
 
80
80
  class << self
81
81
  # Static: Produce a Configuration ready for use in a Site.
82
- # It takes the input, fills in the defaults where values do not
83
- # exist, and patches common issues including migrating options for
84
- # backwards compatiblity. Except where a key or value is being fixed,
85
- # the user configuration will override the defaults.
82
+ # It takes the input, fills in the defaults where values do not exist.
86
83
  #
87
84
  # user_config - a Hash or Configuration of overrides.
88
85
  #
89
- # Returns a Configuration filled with defaults and fixed for common
90
- # problems and backwards-compatibility.
86
+ # Returns a Configuration filled with defaults.
91
87
  def from(user_config)
92
88
  Utils.deep_merge_hashes(DEFAULTS, Configuration[user_config].stringify_keys)
93
89
  .add_default_collections.add_default_excludes
@@ -132,8 +128,8 @@ module Jekyll
132
128
  when %r!\.ya?ml!i
133
129
  SafeYAML.load_file(filename) || {}
134
130
  else
135
- raise ArgumentError, "No parser for '#{filename}' is available.
136
- Use a .y(a)ml or .toml file instead."
131
+ raise ArgumentError,
132
+ "No parser for '#{filename}' is available. Use a .y(a)ml or .toml file instead."
137
133
  end
138
134
  end
139
135
 
@@ -169,7 +165,11 @@ module Jekyll
169
165
  def read_config_file(file)
170
166
  file = File.expand_path(file)
171
167
  next_config = safe_load_file(file)
172
- check_config_is_hash!(next_config, file)
168
+
169
+ unless next_config.is_a?(Hash)
170
+ raise ArgumentError, "Configuration file: (INVALID) #{file}".yellow
171
+ end
172
+
173
173
  Jekyll.logger.info "Configuration file:", file
174
174
  next_config
175
175
  rescue SystemCallError
@@ -177,8 +177,7 @@ module Jekyll
177
177
  Jekyll.logger.warn "Configuration file:", "none"
178
178
  {}
179
179
  else
180
- Jekyll.logger.error "Fatal:", "The configuration file '#{file}'
181
- could not be found."
180
+ Jekyll.logger.error "Fatal:", "The configuration file '#{file}' could not be found."
182
181
  raise LoadError, "The Configuration file '#{file}' could not be found."
183
182
  end
184
183
  end
@@ -199,13 +198,12 @@ module Jekyll
199
198
  new_config = read_config_file(config_file)
200
199
  configuration = Utils.deep_merge_hashes(configuration, new_config)
201
200
  end
202
- rescue ArgumentError => err
203
- Jekyll.logger.warn "WARNING:", "Error reading configuration. " \
204
- "Using defaults (and options)."
205
- warn err
201
+ rescue ArgumentError => e
202
+ Jekyll.logger.warn "WARNING:", "Error reading configuration. Using defaults (and options)."
203
+ warn e
206
204
  end
207
205
 
208
- configuration.backwards_compatibilize.add_default_collections
206
+ configuration.validate.add_default_collections
209
207
  end
210
208
 
211
209
  # Public: Split a CSV string into an array containing its values
@@ -217,35 +215,18 @@ module Jekyll
217
215
  csv.split(",").map(&:strip)
218
216
  end
219
217
 
220
- # Public: Ensure the proper options are set in the configuration to allow for
221
- # backwards-compatibility with Jekyll pre-1.0
218
+ # Public: Ensure the proper options are set in the configuration
222
219
  #
223
- # Returns the backwards-compatible configuration
224
- def backwards_compatibilize
220
+ # Returns the configuration Hash
221
+ def validate
225
222
  config = clone
226
- # Provide backwards-compatibility
227
- check_auto(config)
228
- check_server(config)
229
- check_plugins(config)
230
223
 
231
- renamed_key "server_port", "port", config
232
- renamed_key "gems", "plugins", config
233
- renamed_key "layouts", "layouts_dir", config
234
- renamed_key "data_source", "data_dir", config
235
-
236
- check_pygments(config)
224
+ check_plugins(config)
237
225
  check_include_exclude(config)
238
- check_coderay(config)
239
- check_maruku(config)
240
226
 
241
227
  config
242
228
  end
243
229
 
244
- # DEPRECATED.
245
- def fix_common_issues
246
- self
247
- end
248
-
249
230
  def add_default_collections
250
231
  config = clone
251
232
 
@@ -284,15 +265,6 @@ module Jekyll
284
265
  config
285
266
  end
286
267
 
287
- def renamed_key(old, new, config)
288
- if config.key?(old)
289
- Jekyll::Deprecator.deprecation_message "The '#{old}' configuration" \
290
- " option has been renamed to '#{new}'. Please update your config" \
291
- " file accordingly."
292
- config[new] = config.delete(old)
293
- end
294
- end
295
-
296
268
  private
297
269
 
298
270
  def style_to_permalink(permalink_style)
@@ -305,82 +277,20 @@ module Jekyll
305
277
  "/:categories/:year/:month/:day/:title:output_ext"
306
278
  when :ordinal
307
279
  "/:categories/:year/:y_day/:title:output_ext"
280
+ when :weekdate
281
+ "/:categories/:year/W:week/:short_day/:title:output_ext"
308
282
  else
309
283
  permalink_style.to_s
310
284
  end
311
285
  end
312
286
 
313
- # Private: Checks if a given config is a hash
314
- #
315
- # extracted_config - the value to check
316
- # file - the file from which the config was extracted
317
- #
318
- # Raises an ArgumentError if given config is not a hash
319
- def check_config_is_hash!(extracted_config, file)
320
- unless extracted_config.is_a?(Hash)
321
- raise ArgumentError, "Configuration file: (INVALID) #{file}".yellow
322
- end
323
- end
324
-
325
- def check_auto(config)
326
- if config.key?("auto") || config.key?("watch")
327
- Jekyll::Deprecator.deprecation_message "Auto-regeneration can no longer" \
328
- " be set from your configuration file(s). Use the" \
329
- " --[no-]watch/-w command-line option instead."
330
- config.delete("auto")
331
- config.delete("watch")
332
- end
333
- end
334
-
335
- def check_server(config)
336
- if config.key?("server")
337
- Jekyll::Deprecator.deprecation_message "The 'server' configuration option" \
338
- " is no longer accepted. Use the 'jekyll serve'" \
339
- " subcommand to serve your site with WEBrick."
340
- config.delete("server")
341
- end
342
- end
343
-
344
- def check_pygments(config)
345
- if config.key?("pygments")
346
- Jekyll::Deprecator.deprecation_message "The 'pygments' configuration option" \
347
- " has been renamed to 'highlighter'. Please update your" \
348
- " config file accordingly. The allowed values are 'rouge', " \
349
- "'pygments' or null."
350
-
351
- config["highlighter"] = "pygments" if config["pygments"]
352
- config.delete("pygments")
353
- end
354
- end
355
-
356
287
  def check_include_exclude(config)
357
288
  %w(include exclude).each do |option|
358
- if config[option].is_a?(String)
359
- Jekyll::Deprecator.deprecation_message "The '#{option}' configuration option" \
360
- " must now be specified as an array, but you specified" \
361
- " a string. For now, we've treated the string you provided" \
362
- " as a list of comma-separated values."
363
- config[option] = csv_to_array(config[option])
364
- end
365
- config[option]&.map!(&:to_s)
366
- end
367
- end
289
+ next unless config.key?(option)
290
+ next if config[option].is_a?(Array)
368
291
 
369
- def check_coderay(config)
370
- if (config["kramdown"] || {}).key?("use_coderay")
371
- Jekyll::Deprecator.deprecation_message "Please change 'use_coderay'" \
372
- " to 'enable_coderay' in your configuration file."
373
- config["kramdown"]["use_coderay"] = config["kramdown"].delete("enable_coderay")
374
- end
375
- end
376
-
377
- def check_maruku(config)
378
- if config.fetch("markdown", "kramdown").to_s.casecmp("maruku").zero?
379
- Jekyll.logger.abort_with "Error:", "You're using the 'maruku' " \
380
- "Markdown processor, which has been removed as of 3.0.0. " \
381
- "We recommend you switch to Kramdown. To do this, replace " \
382
- "`markdown: maruku` with `markdown: kramdown` in your " \
383
- "`_config.yml` file."
292
+ raise Jekyll::Errors::InvalidConfigurationError,
293
+ "'#{option}' should be set as an array, but was: #{config[option].inspect}."
384
294
  end
385
295
  end
386
296
 
@@ -389,17 +299,16 @@ module Jekyll
389
299
  # config - the config hash
390
300
  #
391
301
  # Raises a Jekyll::Errors::InvalidConfigurationError if the config `plugins`
392
- # is a string
302
+ # is not an Array.
393
303
  def check_plugins(config)
394
- if config.key?("plugins") && config["plugins"].is_a?(String)
395
- Jekyll.logger.error "Configuration Error:", "You specified the" \
396
- " `plugins` config in your configuration file as a string, please" \
397
- " use an array instead. If you wanted to set the directory of your" \
398
- " plugins, use the config key `plugins_dir` instead."
399
- raise Jekyll::Errors::InvalidConfigurationError,
400
- "'plugins' should not be a string, but was: " \
401
- "#{config["plugins"].inspect}. Use 'plugins_dir' instead."
402
- end
304
+ return unless config.key?("plugins")
305
+ return if config["plugins"].is_a?(Array)
306
+
307
+ Jekyll.logger.error "'plugins' should be set as an array of gem-names, but was: " \
308
+ "#{config["plugins"].inspect}. Use 'plugins_dir' instead to set the directory " \
309
+ "for your non-gemified Ruby plugins."
310
+ raise Jekyll::Errors::InvalidConfigurationError,
311
+ "'plugins' should be set as an array, but was: #{config["plugins"].inspect}."
403
312
  end
404
313
  end
405
314
  end