-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrakefile
41 lines (32 loc) · 1.02 KB
/
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
# http://ixti.net/software/2013/01/28/using-jekyll-plugins-on-github-pages.html
require "rubygems"
require "tmpdir"
require "bundler/setup"
require "jekyll"
GITHUB_REPONAME = "paulsohn/paulsohn.github.io"
desc "Generate blog files"
task :generate do
system "jekyll build" # I hate to do this but below won't work properly
# 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
pwd = Dir.pwd
Dir.chdir tmp
system "cd .."
system "git init -b built"
system "git add ."
# system "git config --global user.email [email protected]"
# system "git config --global user.name Your Name"
message = "Site updated at #{Time.now.utc}"
system "git commit -m #{message.inspect}"
system "git remote add origin https://github.com/#{GITHUB_REPONAME}.git"
system "git push origin built --force"
Dir.chdir pwd
end
end