Tom_sq_150

Tom Copeland

Tom was also a founding member of the company's core software development team and is a known open-source technologist and author. He was selected as Oracle Magazine's first 'Open-Source Developer of the Year' for his creation of the Java code testing software PMD, a project that was also listed as one of the Top 27 Open-Source applications in the world by Software Development Magazine. He has written Generating Parsers with JavaCC and PMD Applied and is a leading Rails developer. Tom is a U.S. Coast Guar Academy graduate and former Coast Guard officer.

Badge_rubyconf10_sm Badge_railswhitepaper Rackspace_partner Badge_training

Follow Us on Twitter

Copeland_headshot_normal

tcopeland A cicada coming of out of its shell http://yfrog.com/0ss0uzj

Rich_normal

Rich Kilmer Did a 3 hour 50 mile ride this morning. Felt good on the ride but now am a wee bit sore.

Avatar_normal

Glenn Vanderburg I like that the Kindle app's dictionary is a book in its own right. But I hate getting dropped into it when looking up from other books.

Hero_headshot_normal

Bruce Williams On my way home to Portland — at JFK John F. Kennedy International http://gowal.la/r/YAKV

Screen_shot_2010-05-11_at_11

Chad Fowler @glv ;)

The rubyforge gem and the RubyForge REST API

Posted by Tom Copeland on 22 September 2009 14:18

Originally published on Tom's Blog at tomecopeland.blogs.com

Yesterday Ryan Davis and I released v2.0.0 of the "rubyforge" gem. The big change for this version is that it no longer interacts with RubyForge by scraping HTML; instead, it uses the new RubyForge REST API. So instead of POST'ing a form to login and fetch your project list, it uses HTTP Basic authentication and hits /users/zenspider/groups.js.

If you're using the new gem, you may see this when you run rubyforge config:

$ rubyforge config
/Library/Ruby/Gems/1.8/gems/json-1.1.7/lib/json/common.rb:122:in `parse': 
618: unexpected token at '<?xml version="1.0" encoding="UTF-8"?> (JSON::ParserError)
<!DOCTYPE html
[ ... lots more ... ]

That's happening because your ~/.rubyforge/user-config.yml file is telling the rubyforge gem to hit https://rubyforge.org, and it needs to hit http://api.rubyforge.org instead. To fix that, either run rubyforge setup, or just edit your ~/.rubyforge/user-config.yml and change the uri setting.

I'm happy to have a REST API for RubyForge available; this has been in the works for a few months and I hope folks come up with some interesting ways to use it. It's certainly much easier (and much more efficient) than the old way of using Mechanize or whatever to parse the HTML. Not all the RubyForge resources are available yet, so if you want to access something and don't see it in the API please let me know and I'll add it. The code is here and feedback is of course welcome. Enjoy!