From ba64a9fe306eb629df3765a15bd995444b0ed2c1 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 16 Apr 2013 18:24:10 +0200 Subject: [PATCH] Fail if destination directory for jekyll new exists and is not empty. Fixes #981. --- lib/jekyll/commands/new.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/jekyll/commands/new.rb b/lib/jekyll/commands/new.rb index e650dc52..c5219e13 100644 --- a/lib/jekyll/commands/new.rb +++ b/lib/jekyll/commands/new.rb @@ -8,6 +8,10 @@ module Jekyll new_blog_path = File.expand_path(args.join(" "), Dir.pwd) FileUtils.mkdir_p new_blog_path + unless Dir["#{new_blog_path}/**/*"].empty? + Jekyll::Logger.error "Conflict:", "#{new_blog_path} exists and is not empty." + exit(1) + end create_sample_files new_blog_path