Skip to content

Commit 4399e80

Browse files
committed
Only touch the FS when absolutely necessary. #11.
1 parent 4b9ce9b commit 4399e80

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/jekyll/commands/draft.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ def self.init_with_program(prog)
1919
def self.process(args = [], options = {})
2020
raise ArgumentError.new('You must specify a name.') if args.empty?
2121

22-
Dir.mkdir("_drafts") unless Dir.exist?("_drafts")
23-
2422
type = options["type"] || Jekyll::Compose::DEFAULT_TYPE
2523
layout = options["layout"] || Jekyll::Compose::DEFAULT_LAYOUT
2624

@@ -31,6 +29,7 @@ def self.process(args = [], options = {})
3129

3230
raise ArgumentError.new("A draft already exists at ./#{draft_path}") if File.exist?(draft_path) and !options["force"]
3331

32+
Dir.mkdir("_drafts") unless Dir.exist?("_drafts")
3433
File.open(draft_path, "w") do |f|
3534
f.puts(front_matter(layout, title))
3635
end

0 commit comments

Comments
 (0)