From bbd466497fe7065a89955942e346660e71761787 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 9 Jun 2013 21:28:12 +0200 Subject: [PATCH 1/2] Remove duplication for include/exclude options in backwards_compatibilize. --- lib/jekyll/configuration.rb | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 4a1f555f..974e5371 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -185,22 +185,15 @@ module Jekyll config.delete('server_port') end - if config.has_key?('exclude') && config['exclude'].is_a?(String) - Jekyll.logger.warn "Deprecation:", "The 'exclude' configuration option" + - " must now be specified as an array, but you specified" + - " a string. For now, we've treated the string you provided" + - " as a list of comma-separated values." - config['exclude'] = csv_to_array(config['exclude']) + %w[include exclude].each do |option| + if config.has_key?(option) && config[option].is_a?(String) + Jekyll.logger.warn "Deprecation:", "The '#{option}' configuration option" + + " must now be specified as an array, but you specified" + + " a string. For now, we've treated the string you provided" + + " as a list of comma-separated values." + config[option] = csv_to_array(config[option]) + end end - - if config.has_key?('include') && config['include'].is_a?(String) - Jekyll.logger.warn "Deprecation:", "The 'include' configuration option" + - " must now be specified as an array, but you specified" + - " a string. For now, we've treated the string you provided" + - " as a list of comma-separated values." - config['include'] = csv_to_array(config['include']) - end - config end From 9d3d095bca57f458bb8db0e6b1dff69faf92b932 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 8 Jul 2013 18:35:16 +0200 Subject: [PATCH 2/2] Simplify check for String include/exclude option. --- lib/jekyll/configuration.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 974e5371..c428c1a6 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -186,7 +186,7 @@ module Jekyll end %w[include exclude].each do |option| - if config.has_key?(option) && config[option].is_a?(String) + if config.fetch(option, []).is_a?(String) Jekyll.logger.warn "Deprecation:", "The '#{option}' configuration option" + " must now be specified as an array, but you specified" + " a string. For now, we've treated the string you provided" +