summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Rakefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/Rakefile b/Rakefile
index 7829d7c..65c2249 100644
--- a/Rakefile
+++ b/Rakefile
@@ -45,7 +45,7 @@ task :post do
abort("rake aborted: '#{CONFIG['posts']}' directory not found.") unless FileTest.directory?(CONFIG['posts'])
title = ENV["title"] || "new-post"
slug = title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
- date = ENV['date'] || Time.now.strftime('%Y-%m-%d')
+ date = (Time.parse(ENV['date']) || Time.now).strftime('%Y-%m-%d')
filename = File.join(CONFIG['posts'], "#{date}-#{slug}.#{CONFIG['post_ext']}")
if File.exist?(filename)
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'