-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
57 lines (48 loc) · 1.23 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
require 'jekyll'
def jekyll(opts="", path="")
sh "rm -rf _site"
sh path + "jekyll " + opts
end
desc "Build site using Jekyll"
task :build do
jekyll
end
desc "Serve on Localhost with port 4000"
task :default do
jekyll "--server --auto"
end
desc "Serve on Localhost with port 4000 using development version"
task :unstable do
jekyll "--server --auto", "../jekyll/bin/"
end
desc "Deploy to Live"
task :deploy do
rsync
end
def rsync()
sh "rsync -rtz --delete _site/ pichot@grmade.org:~/webapps/grmade/"
end
# Change your GitHub reponame
GITHUB_REPONAME = "friendlycode/grmade.org"
namespace :site do
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
Dir.chdir tmp
system "git init"
system "git add ."
message = "Site updated at #{Time.now.utc}"
system "git commit -m #{message.shellescape}"
system "git remote add origin git@github.com:#{GITHUB_REPONAME}.git"
system "git push origin master:refs/heads/gh-pages --force"
end
end
end