-
Notifications
You must be signed in to change notification settings - Fork 1
/
rakefile
51 lines (45 loc) · 1.35 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
# coding: utf-8
deploy_dir = "_deploy"
deploy_branch = "gh-pages"
deploy_remote = "gh"
config_files = Dir.glob("_config/*.yml").join(",")
root = File.expand_path('.')
desc "generate site"
task :generate do
puts("Generating static site into _deploy")
puts config_files
system("jekyll build --config #{config_files}");
end
desc "deploy site"
task :deploy do
puts "Getting ready to deploy."
(Dir["#{deploy_dir}/*"]).each { |f| rm_rf(f) }
puts "Generating site from source."
Rake::Task[:generate].execute
cd "#{deploy_dir}" do
system("git add . --all")
system("git add -u .")
puts "\n## Commiting: Site updated at #{Time.now.utc}"
message = "Site updated at #{Time.now.utc}"
system "git commit -m \"#{message}\""
puts "\n## Pushing generated #{deploy_dir} website"
system "git push #{deploy_remote} #{deploy_branch} --force"
puts "\n## Github Pages deploy complete"
end
end
desc "test deploy site"
task :testdeploy do
puts "Getting ready to test deploy."
(Dir["#{deploy_dir}/*"]).each { |f| rm_rf(f) }
puts "Generating site from source."
Rake::Task[:generate].execute
end
desc "Serves local jekyll server"
task :serve do
cd "#{root}" do
puts "Starting jekyll server."
puts "Config files:"
puts config_files
system("jekyll serve --config #{config_files} --destination #{deploy_dir} --watch")
end
end