Include only the most recent 100 items in the RSS feed.

With the full package list, updates.rss exceeds 512kb, which upsets dlvr.it.
This commit is contained in:
Steve Purcell 2013-08-17 09:00:27 +01:00
parent 6ac228aff4
commit 94a911a576

View file

@ -15,7 +15,7 @@
require 'json' require 'json'
require 'time' require 'time'
require 'ostruct' require 'ostruct'
JSON.parse(File.open("../archive.json").read).each do |pkgname, info| packages = JSON.parse(File.open("../archive.json").read).map do |pkgname, info|
versions, deps, descr, pkgtype = info versions, deps, descr, pkgtype = info
version = versions.join('.') version = versions.join('.')
package = OpenStruct.new package = OpenStruct.new
@ -26,6 +26,9 @@
package.build_time = Time.new(version[0..3].to_i, version[4..5].to_i, version[6..7].to_i, hour_portion[0..1].to_i, hour_portion[2..3].to_i) package.build_time = Time.new(version[0..3].to_i, version[4..5].to_i, version[6..7].to_i, hour_portion[0..1].to_i, hour_portion[2..3].to_i)
package.url = "#{base_url}packages/#{pkgname}-#{version}." + (pkgtype == "single" ? "el" : "tar") package.url = "#{base_url}packages/#{pkgname}-#{version}." + (pkgtype == "single" ? "el" : "tar")
package.info_url = "#{base_url}##{pkgname}" package.info_url = "#{base_url}##{pkgname}"
package
end
packages.sort_by { |p| p.version }.reverse[0..200].each do |package|
%> %>
<item> <item>
<title><%= package.name %> (<%= package.version %>) --- <%= ERB::Util.html_escape package.description %></title> <title><%= package.name %> (<%= package.version %>) --- <%= ERB::Util.html_escape package.description %></title>