forked from plotly/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
executable file
·44 lines (37 loc) · 1.54 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
def git_clean?
git_state = `git status 2> /dev/null | tail -n1`
clean = (git_state =~ /clean/)
end
task :check_git do
unless git_clean?
puts "Dirty repo - commit or discard your changes and run deploy again"
exit 1
end
end
desc "Deploy to remote origin"
task :deploy => [:check_git] do
source_branch = 'source-design-merge'
deploy_branch = 'gh-pages'
message = "Site updated at #{Time.now.utc}"
puts "...git pull origin \"#{source_branch}\""
system "git pull origin \"#{source_branch}\""
puts "...getting latest python docs"
system "rm -rf _posts/python/html" or exit!(1)
system "git clone -b built [email protected]:plotly/plotly.py-docs _posts/python/html" or exit!(1)
puts "...generate _site"
system "jekyll build && git checkout \"#{deploy_branch}\" && git pull origin \"#{deploy_branch}\" && cp -r _site/* . && rm -rf _site/ && touch .nojekyll && git add . && git commit -m \"#{message}\" && git push origin \"#{deploy_branch}\"" or exit!(1)
end
desc "Serve as if deploying"
task :serve => [] do
puts "...getting latest python docs"
system "rm -rf _posts/python/html" or exit!(1)
system "git clone -b built [email protected]:plotly/plotly.py-docs _posts/python/html" or exit!(1)
system "jekyll serve"
end
desc "Serve using copy of adjacent py-docs and _config_personal.yml"
task :personal => [] do
puts "...getting latest python docs"
system "rm -rf _posts/python/html" or exit!(1)
system "cp -r ../plotly.py-docs/build/html _posts/python/html" or exit!(1)
system "jekyll serve --config _config_personal.yml"
end