-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
43 lines (36 loc) · 1.18 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
SRC = FileList["dbi/**/*.d","dbi/*.d"]
TEST_SRC = FileList[SRC,"testddbi.d"]
file "testddbi.exe" => TEST_SRC do
sh "dsss build testddbi.d"
end
task :test => ["testddbi.exe"] do
sh "testddbi"
end
task :default => ["test"]
DMD = RUBY_PLATFORM.match(/win/) ? "dmd_rake.bat" : "dmd"
def do_ddoc(docfile, f)
sh "#{DMD} -version=DDoc -D -Dddocs/api -Df#{docfile} -c -odobjs #{f} docs/candy.ddoc docs/modules.ddoc"
sh "chmod 644 docs/api/#{docfile}"
end
task :refdoc => SRC do
modules = File.new("docs/modules.ddoc", File::CREAT|File::TRUNC|File::RDWR, 0644)
modules.write("MODULES =\n");
tempIndex = File.new("docs/DDBI.d", File::CREAT|File::TRUNC|File::RDWR, 0644)
tempIndex.write("Ddoc<ul>\n");
SRC.each do |f|
modname = f.gsub(/\//, "\.")
docfile = modname.gsub(/\.d/, "\.html")
modname = modname.gsub!(/\.d/, "")
modules.write("$(MODULE_FULL #{modname})\n");
tempIndex.write("<li><a href='#{docfile}'>#{modname}</a></li>\n")
end
modules.close;
tempIndex.write("</ul>");
tempIndex.close
SRC.each do |f|
docfile = f.gsub(/\//, "\.")
docfile = docfile.gsub!(/\.d/, "\.html")
do_ddoc(docfile, f)
end
do_ddoc("index.html", "docs/DDBI.d")
end