-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
46 lines (40 loc) · 1.33 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
require 'rake'
require 'progress_bar'
require 'open3'
task :publish do
puts "+----------------------------------+"
puts "| fishpond |"
puts "| Publishing Examples |"
puts "+----------------------------------+"
puts ""
puts "Note: All changes on master will be"
puts " committed and pushed to origin"
puts " before publishing, as a safety"
puts " precaution."
puts ""
sleep 2 # bailout time.
commands = []
commands << 'git add .'
commands << 'git commit -am "[Automated] Pre-publish safety build"'
commands << 'git pull origin master'
commands << 'git push origin master'
commands << 'bundle exec middleman build'
commands << 'git add build/*'
commands << 'git commit -am "[Automated] Building pages"'
commands << 'git symbolic-ref HEAD refs/heads/gh-pages'
commands << 'git pull origin gh-pages'
commands << 'rm .git/index'
commands << 'git clean -fdx'
commands << 'git checkout master build'
commands << 'mv build/* ./'
commands << 'rmdir build'
commands << 'git add .'
commands << 'git commit -am "[Automated] Published pages"'
commands << 'git push origin gh-pages'
commands << 'git checkout master'
pb = ProgressBar.new(commands.count, :bar, :percentage, :eta)
commands.each do |command|
`#{command} 2>&1`
pb.increment!
end
end