-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.rb
50 lines (47 loc) · 1.03 KB
/
index.rb
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
# This script renders a Helm index.yaml file into nice HTML, similar to what `helm serve` does.
require 'yaml'
index = YAML::load_file(if ARGV.first.nil? then exit 1 else ARGV.first end)
puts %Q{
<html>
<head>
<title>qoqodev charts</title>
<link rel="icon" href="favicon.ico"/>
<style type="text/css">
body {
font-family: Consolas, monaco, monospace;
margin: 40px auto;
max-width: 400px;
line-height: 1.6;
}
ul {
margin-bottom: 15px;
}
</style>
</head>
<h1>qoqodev charts</h1>
<body>
<ul>
#{
index['entries'].map do |k,v|
%Q{
<li>#{k}
<ul>
#{
v.map do |chart|
%Q{
<li>
<a href="#{chart['urls'].first}">#{chart['name']}-#{chart['version']}</a>
</li>
}
end.join
}
</ul>
</li>
}
end.join
}
</ul>
<p>Last Generated: #{index['generated']}</p>
</body>
</html>
}