-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRakefile
More file actions
79 lines (67 loc) · 1.8 KB
/
Rakefile
File metadata and controls
79 lines (67 loc) · 1.8 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# -*- coding: utf-8 -*-
STYLESHEET_PATH = "stylesheet/stylesheet.css"
CONFIG_PATH = "config.yml"
#--------------------
desc "HTML形式で出力"
task :html => :"clean:html" do
mkdir_p("output_html")
sh("review-compile --all --target=html --level=3 --stylesheet=#{STYLESHEET_PATH}")
sh("mv *.html output_html/")
require "rbconfig"
if /mswin|cygwin|mingw/ =~ RbConfig::CONFIG["arch"]
sh("cp -r images output_html/images")
sh("cp -r stylesheet output_html/stylesheet")
else
sh("ln -sf ../images output_html/images")
sh("ln -sf ../stylesheet output_html/stylesheet")
end
end
#--------------------
desc "epub形式で出力"
task :epub => :"clean:epub" do
cp(STYLESHEET_PATH, "stylesheet.css")
sh("review-epubmaker #{CONFIG_PATH}")
rm_rf("stylesheet.css")
end
#--------------------
desc "PDF形式で出力"
task :pdf => :"clean:pdf" do
sh("review-pdfmaker #{CONFIG_PATH}")
end
#--------------------
desc "ページ数表示"
task :volume do
sh("review-vol -P")
end
#--------------------
desc "ReVIEW表記の検証"
task :validate do
files = Dir.glob('*.re')
files.each do |file|
puts "---- #{file}"
system("review-validate #{file}")
puts ""
end
end
#--------------------
namespace :clean do
require "yaml"
desc "生成した全てのファイルを削除"
task :all => [:html, :epub, :pdf] do; end
desc "生成した HTML ファイルを削除"
task :html do
rm_rf("output_html")
end
desc "生成した epub ファイルを削除"
task :epub do
config = YAML.load(File.read(CONFIG_PATH))
rm_rf("#{config["bookname"]}.epub")
end
desc "生成した pdf ファイルを削除"
task :pdf do
config = YAML.load(File.read(CONFIG_PATH))
rm_rf("#{config["bookname"]}.pdf")
end
end
task :default => [:html]
task :clean => [:"clean:all"]