forked from wincent/presentation-template
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
54 lines (42 loc) · 1.36 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
require 'fileutils'
require 'pathname'
HTML_OUT = 'index.html'
HAML_IN = 'index.haml'
HIGHLIGHT_OUT = 'highlight/build/highlight.pack.js'
HIGHLIGHT_IN = 'highlight/src/highlight.js'
OUT_FILES = [HTML_OUT, HIGHLIGHT_OUT]
task :default => :make
desc 'Build the presentation from source'
task :make => OUT_FILES
file HTML_OUT => HAML_IN do
sh "bundle exec haml #{HAML_IN} > #{HTML_OUT}"
end
file HIGHLIGHT_OUT => HIGHLIGHT_IN do
Dir.chdir 'highlight' do
sh 'python tools/build.py'
end
end
desc '"Publish" the presentation to the gh-pages branch'
task :publish => OUT_FILES do
`git diff --quiet`
raise 'dirty worktree' if $?.exitstatus != 0
base = Pathname.new(File.join(__FILE__, '..')).realpath
build = base + 'build'
FileUtils.rm_rf build
FileUtils.mkdir_p build
FileUtils.cp_r(base + 'assets', build)
FileUtils.cp_r(base + 'reveal', build)
FileUtils.cp_r(base + 'highlight', build)
FileUtils.cp(base + 'causes.css', build)
FileUtils.cp(base + HTML_OUT, build)
FileUtils.rm_rf(base + 'highlight')
FileUtils.rm_rf(base + 'reveal')
`git checkout gh-pages`
FileUtils.rm_rf(base + 'assets')
FileUtils.mv(Dir.glob(build + '*'), base, :force => true)
FileUtils.rm_r(build)
`git add --all assets reveal highlight causes.css index.html`
`git commit -m "Built presentation #{Time.now}"`
`git checkout master`
`git submodule update`
end