Skip to content

Commit

Permalink
Automatically generate the Markdown table for GitHub.
Browse files Browse the repository at this point in the history
  • Loading branch information
SadieCat committed Dec 23, 2023
1 parent 0392bb0 commit 17399fc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion html/docker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
output = File.join(INSPIRCD_BUILD_DIR, "index.html")
File.open(output, "w") do |fh|
fh.puts ERB
.new(template)
.new(template, trim_mode: '<>')
.result_with_hash(directory: INSPIRCD_BUILD_DIR, packages: packages)
end
FileUtils.chown INSPIRCD_BUILD_USER, INSPIRCD_BUILD_GROUP, output
13 changes: 13 additions & 0 deletions html/index.rhtml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ def human_size(file)
"#{(bytes / 1_048_576.0).round(2)} MiB"
end
end
def release_file(files)
files.find { |file| file !~ /(?:-dbgsym_|-debug(?:info|source)-|\.src\.)/ }
end
%>
<!DOCTYPE html>
<html>
Expand All @@ -39,6 +42,16 @@ end
</head>
<body>
<h1>InspIRCd Packages</h1>
<h2>GitHub Table</h2>
<pre>
Platform | File | SHA256
------------------------------ | ---------------------------------------- | ------
<% packages.each do |name, files| %>
<%= name.ljust(30) %> | <%= release_file(files).ljust(40).gsub('~', '.') %> | <%= file_hash(release_file(files)) %>
<% end %>
</pre>
<hr>
<% packages.each do |name, files| %>
<h2><%= name %></h2>
<ul>
Expand Down

0 comments on commit 17399fc

Please sign in to comment.