Regenerate download page.

This commit is contained in:
Christian Williams 2010-08-25 18:44:27 -07:00
parent 75238bd3b1
commit f134c6e386
1 changed files with 3 additions and 1 deletions

View File

@ -151,17 +151,19 @@ jasmine.version_= {
require 'digest/sha1' require 'digest/sha1'
download_html = "<!-- START_DOWNLOADS -->\n" download_html = "<!-- START_DOWNLOADS -->\n"
download_html += "<table>\n<tr><th/><th>Version</th><th>Size</th><th>Date</th><th>SHA1</th></tr>\n" download_html += "<table>\n<tr><th></th><th>Version</th><th>Size</th><th>Date</th><th>SHA1</th></tr>\n"
Dir.glob('pages/downloads/*.zip').sort.reverse.each do |f| Dir.glob('pages/downloads/*.zip').sort.reverse.each do |f|
sha1 = Digest::SHA1.hexdigest File.read(f) sha1 = Digest::SHA1.hexdigest File.read(f)
fn = f.sub(/^pages\//, '') fn = f.sub(/^pages\//, '')
version = /jasmine-standalone-(.*).zip/.match(f)[1] version = /jasmine-standalone-(.*).zip/.match(f)[1]
download_html += "<tr>\n"
download_html += "<td class=\"link\"><a href='#{fn}'>#{fn.sub(/downloads\//, '')}</a></td>\n" download_html += "<td class=\"link\"><a href='#{fn}'>#{fn.sub(/downloads\//, '')}</a></td>\n"
download_html += "<td class=\"version\">#{version}</td>\n" download_html += "<td class=\"version\">#{version}</td>\n"
download_html += "<td class=\"size\">#{File.size(f) / 1024}k</td>\n" download_html += "<td class=\"size\">#{File.size(f) / 1024}k</td>\n"
download_html += "<td class=\"date\">#{File.mtime(f).strftime("%Y/%m/%d %H:%M:%S %Z")}</td>\n" download_html += "<td class=\"date\">#{File.mtime(f).strftime("%Y/%m/%d %H:%M:%S %Z")}</td>\n"
download_html += "<td class=\"sha\">#{sha1}</td>\n" download_html += "<td class=\"sha\">#{sha1}</td>\n"
download_html += "</tr>\n"
end end
download_html += "</table>\n<!-- END_DOWNLOADS -->" download_html += "</table>\n<!-- END_DOWNLOADS -->"