Add category to rake new_post

This commit is contained in:
Michael Rose
2014-02-27 15:00:37 -05:00
parent 938c653c71
commit 0cdcde10bf
5 changed files with 6 additions and 20 deletions

View File

@@ -25,6 +25,7 @@ task :new_post, :title do |t, args|
if File.exist?(filename)
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
end
category = get_stdin("Enter category name to group your post in (leave blank for none): ")
tags = get_stdin("Enter tags to classify your post (comma separated): ")
puts "Creating new post: #{filename}"
open(filename, 'w') do |post|
@@ -32,6 +33,7 @@ task :new_post, :title do |t, args|
post.puts "layout: post"
post.puts "title: \"#{title.gsub(/&/,'&')}\""
post.puts "modified: #{Time.now.strftime('%Y-%m-%d %H:%M:%S %z')}"
post.puts "category: [#{category}]"
post.puts "tags: [#{tags}]"
post.puts "image:"
post.puts " feature: "