Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 46bc44b343
Fetching contributors…

Cannot retrieve contributors at this time

16 lines (14 sloc) 0.466 kb
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
Jump to Line
Something went wrong with that request. Please try again.