Ruby On Rails RSS Reader

We moved our Athlo blog to a WordPress app to separate it completely from the main app. One interaction I wanted between the two though was that I wanted the most recent blog entries to show on the Athlo site. I thought that RSS would offer an easy solution so I started looking around to find out if I’d need a Rails plugin or something like that.

The solution was far simpler. And pure Ruby (man I love this language!).

require 'rss'
rss = RSS::Parser.parse(open('http://blog.athlo.com/feed/').read, false).items[0..MaxRSSItems-1]

That’s it. That simple call supplies you with a full array of all the items from the RSS feed. In my specific example, I’ve used a range to limit the results to the value of MaxRSSItems.

No plugins required. No Rails required. Ruby RSS will do what you need to read feeds. (That should be in a poem.)

Adding Talk / Discussion Pages To Trac

I’m a big fan of wikis in general. This week I implemented one to help organize the Athlo project. There are literally dozens of wikis to choose from, but ultimately I went with Trac as it has built in milestone management and is super easy to install on Fedora.

One thing that bothered me was the lack of discussion or talk pages. Luckily, Trac is built on Python and uses the ClearSilver template engine so hacking in this functionality was very easy. Here’s what I did.

In the /usr/share/trac/templates folder, there is a file called wiki.cs. It is the template that defines the wiki (duh). Around line 28, the code looks like:

/usr/share/trac/templates/wiki.cs
  • Start Page
  • Index by Title
  • Index by Date
  • Last Change
  • This defines the links that appear just under the main menus that appear horizontally in the default layout. To add talk pages, I simply modified the code like this:

    /usr/share/trac/templates/wiki.cs
    
  • Start Page
  • Index by Title
  • Index by Date
  • Last Change
  • Talk
  • Note that last part. It simply checks to see if you’re on a Talk page already. If not, if creates a link on the text Talk. If you’re viewing SomeWikiPage, the link will point to Talk:SomeWikiPage. If you’ve ever used wikipedia, it should be very familiar.

    What’s nice is this same technique can be used to create any number of meta pages. Happy trac’ing and hacking.