-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
40 lines (36 loc) · 925 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
require 'rubygems'
require 'rake'
require 'rdoc'
require 'date'
require 'yaml'
require 'tmpdir'
require 'jekyll'
desc "Generate static webpages"
task :generate do
Jekyll::Site.new(Jekyll.configuration({
"source" => ".",
"destination" => "_site"
})).process
end
desc "Generate and publish pages to gh-pages"
task :publish => [:generate] do
Dir.mktmpdir do |tmp|
system "mv _site/* #{tmp}"
system "git remote update"
system "git stash"
system "git checkout gh-pages"
system "git reset --hard origin/gh-pages"
system "git rm -r ."
system "rm -rf *"
system "mv #{tmp}/* ."
system "touch .nojekyll"
system "git add .nojekyll"
system "git add ."
message = "Site updated at #{Time.now.utc}"
system "git commit -am #{message.shellescape}"
system "git push"
system "git checkout master"
system "git stash pop"
end
end
task :default => :generate