[Ruby] Behaviour Driven Development with RSpec

Par défaut

During the rewritting of Feevy.com with Merb, I’m discovering RSpec, a framework to be sure your code behave nicely.

Follow and join Feevy rewrite on Gitorious

Instead of normal test-units, you describe how your app/model should behave, which give a more-human conversation when you read your test:

  it "should create a feed from website http://blog.feevy.com" do

    feed = Feed.new :website => "http://blog.feevy.com"

    feed.valid?(:save).should == true

    feed.link.should == "http://blog.feevy.com/feed/"
    feed.website.should == "http://blog.feevy.com"
    feed.title.should == "Feevy Blog"

  end

To re-initialize your database between each test:

  before(:each) do
      Feed.delete_all
  end

Next step: writing Feevy stories

[Ruby] RFeedFinder and RFeedReader

Par défaut

In the refactoring process of Feevy.com (mostly to remove dirty spaghetti code), I’ve write my first 2 ruby gems, with some time to learn and practice with new toys for ruby.

Rubyforge

http://www.rubyforge.org

That’s the place that hosted most of rubygems and is the most useful to deploy your own, it comes with all you need to start and deploy a project: svn, webspace, bug tracker, forum…
But it would be a pain to deploy everything by hand, a gem is available to do it quicker.

New Gem

http://newgem.rubyforge.org/

It’s a simple gem that would generate for you an environment where to build your gem, with a few rake tasks to easily deploy it locally and on rubyforge.

Configuration is simple, just replace ‘FIXME‘ in code with what is needed and start coding your new gem.

To deploy on Rubyforge, don’t forget to setup your access on your local machine.

RFeedFinder

http://rfeedfinder.rubyforge.org/

Main purpose of RFeedFinder is to locate the feed url inside a webpage. It can be really tricky, sometimes using recursion or lucky guesses, but it should work 95% of the time.

RFeedReader

http://rfeedreader.rubyforge.org/

Once we’ve got a feed to parse on Feevy, we want to read its first item. That the purpose of this gem.

Another purpose is to use this gem to update Feevy posts from external clients. Feevy server was doing all the job when a feed was updated, now updater clients can parse the feeds too, and return the complete info to Feevy server, so we’ve another performance boost on the central server.

Feevy: Eating your own dog-food

Par défaut

Because we’re currently developping some WordPress extensions for Feevy, it’s time to integrate it on this weblog too.

Feevy Sidebar Widget

First release of Feevy sidebar widget, that would people using free wordpress.com account to get Feevy in their sidebars.

To test it on your ‘own-managed’ wordpress weblog:

  • Download and install Sidebar Widget plugin. Your WordPress theme need to be compatible, or you can modify it using these instructions;
  • Download and install Feevy Sidebar Widget;
  • Configure your Feevy widget in Sidebar Widget configuration panel.

You can add up to 9 Feevy in your sidebar (or sidebars). It would be particulary useful for people using tags.

Coming plugin: Feevy Blogroll

This plugin will insert a new panel in WordPress Blogroll section, allowing you to manage your Feevy directly from your WordPress admin.

More to come soon 😉