-
Notifications
You must be signed in to change notification settings - Fork 1
/
Rakefile
117 lines (98 loc) · 2.97 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
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
require './_assets/rake/globals.rb'
require './_assets/rake/asciidoc.rb'
# ==============================================================================
# --------------------{ P R O J E C T S E T T I N G S }---------------------
# ==============================================================================
ADOC_ASSETS_DIR = '_assets/adoc'
HTML_DOCS_OUT_DIR = 'doc'
# ==============================================================================
# -------------------------------{ T A S K S }--------------------------------
# ==============================================================================
task :default => [:manpages, :refman, :docinfo]
## Clean & Clobber
##################
require 'rake/clean'
CLOBBER.include(
'_assets-src/sass/*.css',
'_assets/adoc/docinfo.html',
'doc/*.html'
)
## Sass/CSS => Docinfo File
###########################
SASS_DIR = '_assets-src/sass'
SASS_DEPS = FileList["#{SASS_DIR}/*.scss"]
CSS_TARGET = "#{SASS_DIR}/toolmaker.css"
ADOC_DOCINFO = "#{ADOC_ASSETS_DIR}/docinfo.html"
desc "Build custom CSS via Sass"
task :sass => CSS_TARGET
file CSS_TARGET => SASS_DEPS do |t|
cd SASS_DIR
sh "sass toolmaker.scss:toolmaker.css"
cd $repo_root, verbose: false
end
desc "Build Docinfo file w/CSS"
task :docinfo => ADOC_DOCINFO
file ADOC_DOCINFO => CSS_TARGET do |t|
puts "\n# building docinfo file from CSS #"
css_file = File.open(t.source)
File.open(t.name, "w") do |docinfo_file|
docinfo_file.write "<style>\n"
css_file.each_line(chomp: true) do |line|
docinfo_file.puts line
end
docinfo_file.write "</style>\n"
end
css_file.close
end
## Man Pages
############
desc "Convert Man Pages to HTML"
task :manpages
MANPAGES_SRC_DIR = 'docs-src/man-pages'
MANPAGES_OUT_DIR = HTML_DOCS_OUT_DIR
MANPAGES_ADOC_DEPS = FileList[
"#{MANPAGES_SRC_DIR}/shared/*.adoc",
"#{ADOC_ASSETS_DIR}/docinfo.html"
]
MANPAGES_ADOC_OPTS = <<~HEREDOC
--failure-level WARN \
--verbose \
--timings \
--safe-mode unsafe \
-a source-highlighter=rouge \
-a rouge-style=thankful_eyes
HEREDOC
CreateAsciiDocHTMLTasksFromFolder(
:manpages,
MANPAGES_SRC_DIR,
MANPAGES_ADOC_DEPS,
MANPAGES_ADOC_OPTS,
MANPAGES_OUT_DIR
)
## Reference Manual
###################
REFMAN_SRC = 'docs-src/ref-man/ToolMaker-Manual.asciidoc'
REFMAN_OUT_DIR = HTML_DOCS_OUT_DIR
REFMAN_OUT_DIR_ABSPATH = File.expand_path(REFMAN_OUT_DIR)
REFMAN_HTML = REFMAN_OUT_DIR + '/ToolMaker-Manual.html'
REFMAN_ADOC_DEPS = FileList[
'docs-src/ref-man/*.adoc',
'docs-src/ref-man/images/*.gif'
]
REFMAN_ADOC_OPTS = <<~HEREDOC
--failure-level WARN \
--verbose \
--timings \
--safe-mode unsafe \
-a source-highlighter=rouge \
-a rouge-style=thankful_eyes \
-a docinfodir=#{$repo_root}/#{ADOC_ASSETS_DIR} \
-a docinfo@=shared-head \
-a data-uri \
-D #{REFMAN_OUT_DIR_ABSPATH}
HEREDOC
desc "Convert Reference Manual to HTML"
task :refman => REFMAN_HTML
file REFMAN_HTML => [REFMAN_SRC, *REFMAN_ADOC_DEPS] do |t|
AsciidoctorConvert(REFMAN_SRC, REFMAN_ADOC_OPTS)
end