forked from arfc/arfc.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
42 lines (32 loc) · 903 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
36
37
38
39
40
41
42
require "rubygems"
require "tmpdir"
require "jekyll"
require "jekyll/scholar"
# Change your GitHub reponame
GITHUB_REPONAME = "arfc/arfc.github.io"
desc "Generate blog files"
task :generate do
Jekyll::Site.new(Jekyll.configuration({
"source" => ".",
"destination" => "_site"
})).process
end
desc "Generate and publish blog to gh-pages"
task :publish => [:generate] do
Dir.mktmpdir do |tmp|
cp_r "_site/.", tmp
system "rm -r _site"
pwd = Dir.pwd
system "git checkout master"
system "rm -r *"
cp_r "#{tmp}/.", "."
system "git add ."
message = "Site updated at #{Time.now.utc}"
system "git commit -am #{message.inspect}"
system "git remote add upstream [email protected]:#{GITHUB_REPONAME}.git"
system "git push upstream master --force"
Dir.chdir pwd
system "git checkout source"
system "git push upstream source"
end
end