forked from csuwebdev/csuwebdev.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
34 lines (28 loc) · 672 Bytes
/
Copy pathRakefile
File metadata and controls
34 lines (28 loc) · 672 Bytes
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
require 'time'
require 'rake-jekyll'
desc 'create a new draft post'
task :new do
title = ENV['title']
if title.nil?
puts 'A title is required. Usage: rake post title="Your Title"'
else
file = File.join(
File.dirname(__FILE__),
'_posts/' +
Date.today.to_s + '-' + title.downcase.gsub(/[^\w]+/, '-') + '.md'
)
File.open(file, "w") do |f|
f << <<-EOS.gsub(/^ /, '')
---
layout: post
title: #{title}
published: false
categories: blog
---
EOS
end
end
end
Rake::Jekyll::GitDeployTask.new(:deploy) do |t|
t.deploy_branch = 'master'
end