Show number of packages in archive on html page

This commit is contained in:
Steve Purcell 2012-05-24 12:51:56 +01:00
parent 58ef2b3055
commit 48bc01a6d9

View file

@ -10,8 +10,6 @@
**Last Update:** *<%= Time.now.strftime("%Y.%m.%d %H:%M %z") %>*
## Current List of Packages
<%
def parse str
# credit to: http://stackoverflow.com/q/3128406/154508
@ -37,10 +35,8 @@
headers = ["Package", "Version", "Description", "Source"]
data = parse(File.open("../packages/archive-contents").read)[1..-1]
data.map! do |row|
pkgname = row[0]
pkgurl = "packages/#{row[0]}-#{row[1]}." + (row[-1] == "single" ? "el" : "tar")
@ -61,6 +57,7 @@
end
end
%>
<%= "## Current List of #{data.size} Packages" %>
<%=
headers.to_enum(:each_with_index).map{
|h,i| h + " "*(colwidth[i]-h.length) }.join(" ")