-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
executable file
·51 lines (41 loc) · 1.07 KB
/
Rakefile
File metadata and controls
executable file
·51 lines (41 loc) · 1.07 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
require 'rubygems'
require 'rake'
require 'fileutils'
require "date"
desc "Draft a new post"
task :new do
puts "What should we call this post for now?"
name = STDIN.gets.chomp
puts "What Category?"
category = STDIN.gets.chomp
filename = "#{DateTime.now.year}-#{DateTime.now.month}-#{DateTime.now.day}-#{name}"
FileUtils.touch("_posts/#{filename}.markdown")
open("_posts/#{filename}.markdown", 'a') do |f|
f.puts "---"
f.puts "layout: post2"
f.puts "title: \"#{name}\""
f.puts "Category: \"#{category}\""
f.puts "year: #{DateTime.now.year}"
f.puts "month: #{DateTime.now.month}"
f.puts "day: #{DateTime.now.day}"
f.puts "published: false"
f.puts "tags: blog_post"
f.puts "---"
end
end
desc "Startup Jekyll"
task :start do
sh "jekyll --server"
end
desc "Prepare to deploy"
task :deploy do
puts "Commit Description?"
description = STDIN.gets.chomp
sh "cp -rf _site/tags/ tags"
sh "git add ."
sh "git commit -am '#{description}'"
puts "Commited"
sh "git push origin master"
puts "Deployed"
end
task :default => :deploy