Add per gem rss feed #479

merged 1 commit into from Nov 28, 2012

6 participants


Add an atom feed for version list of an individual gem. Allows user to subscribe to version changes without registering (by subscribing with an rss reader).

Fixes #466

@grosser grosser commented on the diff Nov 4, 2012
@@ -27,6 +27,7 @@
<%= documentation_link(@latest_version, @rubygem.linkset) %>
<%= subscribe_link(@rubygem) if @latest_version.indexed %>
<%= unsubscribe_link(@rubygem) %>
+ <%= atom_link(@rubygem) %>
grosser Nov 4, 2012

if you also put it into the header the browser can show it in the url-bar rss dropdown


Some kind of test like 'it renders versions via atom' would be nice so the code gets at least executed once

@grosser grosser and 1 other commented on an outdated diff Nov 4, 2012
@@ -0,0 +1,27 @@
+xml.feed "xmlns" => "" do
+ xml.title "Rubygems | Latest Gems"
+ "rel" => "self", "href" => rubygems_url(:format => :atom)
+ "rel" => "alternate", "href" => rubygems_url
+ rubygems_url
+ xml.updated(@versions.first.updated_at.strftime("%Y-%m-%dT%H:%M:%SZ")) if @versions.any?
grosser Nov 4, 2012

not sure if this needs to be formatted by hand, maybe there is a to_s(:xml) or simply passing a date already renders it correctly

pjg Nov 6, 2012

There's #iso8601 for that:

xml.updated(@versions.first.updated_at.iso8601) if @versions.any?

Can we add a test to this?

@cmeiklejohn cmeiklejohn closed this Nov 4, 2012

Oops, didn't mean to close. Hit the wrong button.

@cmeiklejohn cmeiklejohn reopened this Nov 4, 2012
RubyGems member

I am -1 until we have at least a functional test for this.


Agreed, it is in the works (with a few other tweaks) but got swamped with a couple conference talks this week. Planning on wrapping this later in the week.


Added functional test for the feed, also replaced the hand formated updated string with the Ruby stdlib iso8601 method which was suggested by @pjg

There is a lot of duplication with the index and feed builder, but I haven't spent any time looking at drying that up (I'd say its probably a second issue). Let me know if you'd prefer the refactor now.


I think it is easier to DRY it up while you are thinking about it.

@amateurhuman amateurhuman Add atom link for single gem versions feed
Add atom builder for single gem version

Add styles for rss link

Add yield head for injecting atom feed link

Include link tag in head for rss feed

Add gem name to feed title, add test for atom feed

Use ruby stdlib iso8601 method instead of hand formatted

Refactor individual and all versions feeds to share some builder partial

Alright, the Latest Versions feeds for both individual gems and the site-wide feed are sharing the same builder partial. I think that completes everyone's suggestions, so I've rebased and squashed all the changes into a single commit.



@adkron adkron merged commit 2e70398 into rubygems:master Nov 28, 2012

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment