forked from alecharp/blog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
29 lines (27 loc) · 808 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
desc 'Running Jekyll with --server --auto options'
task :dev do
system('jekyll --server --auto --future')
end
desc 'Generating CSS'
task :css do
system('scss resources/css/*.scss resources/css/alecharp.css --style compressed')
end
desc "Given a title as an argument, create a new post file"
task :new, :title do |t, args|
filename = "#{Time.now.strftime('%Y-%m-%d')}-#{args.title.gsub(/\s/, '-').downcase}.md"
path = File.join("_posts", filename)
if File.exist? path; raise RuntimeError.new("Won't clobber #{path}"); end
File.open(path, 'w') do |file|
file.write <<-EOS
---
layout: post
title: #{args.title}
date: #{Time.now.strftime('%Y-%m-%d %k:%M:%S')}
author: #{`git config --get user.email`.strip.chomp}
tags: misc
excerpt:
---
EOS
end
puts "Now open #{path} in an editor."
end