-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
35 lines (29 loc) · 878 Bytes
/
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
28
29
30
31
32
33
34
35
# -*- encoding: utf-8 -*-
require 'date'
namespace :wurbe do
POSTS_PATH = File.join(File.dirname(__FILE__), 'content', '_posts')
desc "Create a new blog post"
task :new_post, :title do |t, args|
args.with_default(:title => "wurbe #xx")
title = args[:title].strip.downcase
today = Date.today.to_s
new_post_filename = File.join(POSTS_PATH, "#{title}.textile")
new_post_metadata = <<-POST
\n# #{title}
#{today}, #{today}
atomdate: #{Time.now.getgm.strftime("%Y-%m-%dT%H:%M:%SZ")}
author: #{`git config --get user.name`.strip}
categories: blog
POST
File.open("#{POSTS_PATH}.mkd", "a") do |f|
f.write(new_post_metadata)
end
puts "√ Added #{title} to post list"
File.open(new_post_filename, 'w') do |f|
f.write(<<-EOF)
IT WAS AWESOME LOL
EOF
end
puts "√ Created #{new_post_filename}"
end
end