From 12331811dd0ab2a5b8a7849d564ed0d37230897c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20M=C3=B6ller?= Date: Fri, 4 May 2018 16:17:14 +0200 Subject: [PATCH] Enhancement: Adjust doctor command --- lib/jekyll/commands/doctor.rb | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/jekyll/commands/doctor.rb b/lib/jekyll/commands/doctor.rb index bb313152c37..661a978605a 100644 --- a/lib/jekyll/commands/doctor.rb +++ b/lib/jekyll/commands/doctor.rb @@ -39,18 +39,28 @@ def healthy?(site) !conflicting_urls(site), !urls_only_differ_by_case(site), proper_site_url?(site), + properly_gathered_drafts?(site), properly_gathered_posts?(site), ].all? end + def properly_gathered_drafts?(site) + outside_custom_collections_dir(site, "_drafts") + end + def properly_gathered_posts?(site) + outside_custom_collections_dir(site, "_posts") + end + + private + def outside_custom_collections_dir?(site, directory) return true if site.config["collections_dir"].empty? - posts_at_root = site.in_source_dir("_posts") - return true unless File.directory?(posts_at_root) + at_root = site.in_source_dir(directory) + return true unless File.directory?(at_root) Jekyll.logger.warn "Warning:", - "Detected '_posts' directory outside custom `collections_dir`!" + "Detected '#{directory}' directory outside custom `collections_dir`!" Jekyll.logger.warn "", - "Please move '#{posts_at_root}' into the custom directory at " \ + "Please move '#{directory}' into the custom directory at " \ "'#{site.in_source_dir(site.config["collections_dir"])}'" false end