-
Notifications
You must be signed in to change notification settings - Fork 26
/
Rakefile
76 lines (68 loc) · 1.41 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
# -*- ruby -*-
require "rubygems"
require "bundler/gem_helper"
base_dir = File.join(File.dirname(__FILE__))
helper = Bundler::GemHelper.new(base_dir)
def helper.version_tag
version
end
helper.install
spec = helper.gemspec
task default: :test
desc "Run tests"
task :test do
ruby("test/run-test.rb")
end
desc "Generate an artifact for GitHub Pages"
task :pages do
pages_dir = "_site"
rm_rf(pages_dir)
mkdir_p(pages_dir)
require "cgi/util"
require_relative "lib/datasets/lazy"
File.open("#{pages_dir}/index.html", "w") do |index_html|
index_html.puts(<<-HTML)
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Red Datasets</title>
<style>
table {
margin-left: 20vw;
min-width: 50%;
}
th {
font-size: 30px;
padding: 20px;
}
td {
border-bottom: 1px solid #D9DCE0;
padding: 20px;
font-weight: bold;
}
</style>
</head>
<body>
<section>
<h1>Red Datasets</h1>
<table>
<thead>
<tr><th>Available datasets</th></tr>
</thead>
<tbody>
HTML
Datasets::LAZY_LOADER.constant_names.sort.each do |constant_name|
index_html.puts(<<-HTML)
<tr><td>#{CGI.escapeHTML("Datasets::#{constant_name}")}</td></tr>
HTML
end
index_html.puts(<<-HTML)
</tbody>
</table>
</section>
</body>
</html>
HTML
end
end