-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathrakefile
27 lines (27 loc) · 1.03 KB
/
rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# adapted from https://github.com/imathis/octopress/blob/master/Rakefile
# usage rake new_post['My New Post'] or rake new_post (defaults to "My New Post")
desc "Start a new post"
task :new, :title do |t, args|
args.with_defaults(:title => 'My New Post')
title = args.title
filename = "_posts/#{Time.now.strftime('%Y-%m-%d')}-#{title.downcase.gsub(/&/,'and').gsub(/[,'":\?!\(\)\[\]]/,'').gsub(/[\W\.]/, '-').gsub(/-+$/,'')}.md"
puts "Creating new post: #{filename}"
open(filename, 'w') do |post|
post.puts "---"
post.puts "layout: post"
post.puts "title: \"#{title.gsub(/&/,'&')}\""
post.puts "description: """
post.puts "headline: """
post.puts "modified: #{Time.now.strftime('%Y-%m-%d')}"
post.puts "category: personal"
post.puts "tags: []"
post.puts "image: "
post.puts " feature: "
post.puts " location: "
post.puts " locationlink: "
post.puts " credit: "
post.puts " creditlink: "
post.puts "comments: true"
post.puts "---"
end
end