This repository has been archived by the owner on Jul 19, 2018. It is now read-only.
forked from mpv-player/mpv.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
48 lines (45 loc) · 1.59 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
def rst2html
xs = %w(rst2html rst2html.py)
xs = xs.map {|x| `which #{x}`.chomp}.delete_if {|x| x == ""}
r = xs[0]
r || (raise "rst2html not found")
end
desc "Builds mpv's manual"
task :build_mpv_manual do
unless File.exists?('mpv')
system "git clone https://github.com/mpv-player/mpv.git mpv"
end
system("cd mpv && git checkout master && git pull origin master")
system([
rst2html,
'--template=rst2html_template',
'mpv/DOCS/man/mpv.rst',
'source/manual/_master.html.erb'
].join(' '))
system("echo $(cd mpv && git tag --sort=version:refname | tail -1) > source/manual/_stable_version.html.erb")
system("cd mpv && git checkout $(git tag --sort=version:refname | tail -1)")
system([
rst2html,
'--template=rst2html_template',
'mpv/DOCS/man/mpv.rst',
'source/manual/_stable.html.erb'
].join(' '))
end
desc 'Generate site from Travis CI and publish site to GitHub Pages'
task :travis => :build_mpv_manual do
# use public URL for clone
system "git clone https://github.com/mpv-player/mpv-player.git build"
system "bundle exec middleman build --verbose"
system "cd build && git config user.name 'nadeko'"
system "cd build && git config user.email 'nadeko@travis'"
system 'cd build && git config credential.helper "store --file=.git/credentials"'
File.open('build/.git/credentials', 'w') do |f|
f.write("https://#{ENV['GH_TOKEN']}:@github.com")
end
system [
"cd build",
"git add -A .",
"git commit -m 'travis autodeploy #{ENV['TRAVIS_COMMIT_RANGE']}'",
"git push origin master" ].join(" && ")
File.delete 'build/.git/credentials'
end