From 4c1ff9dbac42a6cb9261ce7ce3f90eebb3b8475c Mon Sep 17 00:00:00 2001 From: "Joshua J. Campoverde" Date: Sat, 17 Jan 2015 10:04:26 -0800 Subject: [PATCH] Create _drafts folder if it does not exist - When using the drafts command, if the _drafts folder does not already exist, create it. This prevents errors when running the draft command for the first time on Jekyll 2.5.3. --- lib/jekyll-compose/version.rb | 2 +- lib/jekyll/commands/draft.rb | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/jekyll-compose/version.rb b/lib/jekyll-compose/version.rb index 10bd1dd..a622a19 100644 --- a/lib/jekyll-compose/version.rb +++ b/lib/jekyll-compose/version.rb @@ -1,5 +1,5 @@ module Jekyll module Compose - VERSION = "0.2.0" + VERSION = "0.2.1" end end diff --git a/lib/jekyll/commands/draft.rb b/lib/jekyll/commands/draft.rb index 7272f42..80b9097 100644 --- a/lib/jekyll/commands/draft.rb +++ b/lib/jekyll/commands/draft.rb @@ -19,6 +19,8 @@ def self.init_with_program(prog) def self.process(args = [], options = {}) raise ArgumentError.new('You must specify a name.') if args.empty? + Dir.mkdir("_drafts") unless Dir.exist?("_drafts") + type = options["type"] || Jekyll::Compose::DEFAULT_TYPE layout = options["layout"] || Jekyll::Compose::DEFAULT_LAYOUT