We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 02e2f86 commit 2d629f2Copy full SHA for 2d629f2
Rakefile
@@ -45,7 +45,7 @@ task :post do
45
abort("rake aborted: '#{CONFIG['posts']}' directory not found.") unless FileTest.directory?(CONFIG['posts'])
46
title = ENV["title"] || "new-post"
47
slug = title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
48
- date = ENV['date'] || Time.now.strftime('%Y-%m-%d')
+ date = (Time.parse(ENV['date']) || Time.now).strftime('%Y-%m-%d')
49
filename = File.join(CONFIG['posts'], "#{date}-#{slug}.#{CONFIG['post_ext']}")
50
if File.exist?(filename)
51
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
0 commit comments