Permalink
Browse files

adding rake task to make new post

  • Loading branch information...
1 parent 60e70ea commit 5647ec61caf8b8c59705503109a481279fe394a6 @steveklabnik committed Mar 5, 2012
Showing with 15 additions and 0 deletions.
  1. +15 −0 Rakefile
View
@@ -0,0 +1,15 @@
+desc "Make a new post"
+task :new_post, :title do |t, args|
+ args.with_defaults(:title => 'new-post')
+ title = args.title
+ date = Time.now.strftime('%Y-%m-%d')
+ filename = "posts/#{date}-#{title.downcase.gsub(/\W/, "-")}.md"
+
+ puts "Creating new post: #{filename}"
+ open(filename, 'w') do |post|
+ post.puts "---"
+ post.puts "title: \"#{title.gsub(/&/,'&')}\""
+ post.puts "date: #{Time.now.strftime('%Y-%m-%d %H:%M')}"
+ post.puts "---"
+ end
+end

0 comments on commit 5647ec6

Please sign in to comment.