forked from loongson/LoongArch-Documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
37 lines (32 loc) · 1.27 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
namespace :book do
books = FileList['docs/*.adoc']
desc 'build basic book formats'
task :all =>[:html, :pdf]
desc 'generate contributors list'
task :generate do |t|
ENV["LC_ALL"] = "C"
puts 'Generating contributors list...'
`git shortlog --summary --email HEAD | grep -v -E "users\.noreply\.github\.com" | cut -f 2- | sort --ignore-case > contributors.txt`
puts ' -- contributors list generation done!'
end
desc 'build HTML format'
task :html, [:arg] do |t, args|
Rake::Task['book:generate'].invoke
args.with_defaults(:arg => books)
puts 'Converting to HTML...'
`bundle exec asciidoctor -v -b html5 -a stylesheet=../themes/html.css -a data-uri -D public #{args[:arg]}`
puts ' -- HTML conversion done!'
end
desc 'build PDF format'
task :pdf, [:arg] do |t, args|
Rake::Task['book:generate'].invoke
args.with_defaults(:arg => books)
puts 'Converting to PDF... (this will take a while)'
`bundle exec asciidoctor-pdf -v -a pdf-theme=themes/pdf.yml -a pdf-fontsdir="fonts;GEM_FONTS_DIR" -D public #{args[:arg]}`
puts ' -- PDF conversion done!'
end
desc 'clean all generated files'
task :clean do |t|
rm_rf 'public'
end
end