Archive for November, 2008

Release 0.8.2

Sunday, November 30th, 2008

Hey there folks, sorry for the long wait for this release, but it’s here. It’s been a long November for yours truly. I’ve had to find a new job. I’ve had pneumonia. We, at least in America, have celebrated Thanksgiving. And, of course, who can forget RubyConf 2008?

So with that said, what’s in 0.8.2? Honestly, not a whole lot. There are a couple of bug fixes, a button_to_remote (think submit_to_remote in Rails) helper, and deferred routes. More on deferred routes in a moment, as it’s actually a pretty cool feature that only Mack and Merb share. And finally there is bundled gems.

Bundled Gems

What do I mean I say ‘bundled gems’? Well, because of the rather large number of gems that get installed with Mack, and because of some gem version dependency issues, Mack is now bundling it’s third party dependency gems inside itself. For example, mack-facets used to rely on the gems ‘facets’ and ‘english’. Those gems are now bundled inside the mack-facets gem and now longer need to be downloaded and installed by end users. This should make installing Mack super easy. It should also make dealing with having multiple versions of Mack installed on your system easier to deal with and maintain.

Deferred? Routes

So what are deferred routes? Ezra wrote a really great write up back in April. The idea is simple, with newer web servers such as Thin and Ebb, you can tell them to spawn a new thread to handle particular requests, such as long running processes like file uploads. This can really help speed things up as server can process regular requests using an event machine model, which is very fast, but can be really slow and block the server for longer processes. Now those processes can spawn into their own threads and not block the server.

In Mack 0.8.2 you can mark your routes with a deferred? => true option which will trigger this behavior. It’s much more advanced than the similar feature that can be found in Merb, which requires a separate configuration for your deferred actions, and the urls have to be ‘hard coded’. Mack let’s you use all the dynamic power of your routes, like you would want to. It’s just another option on the route itself. For a great tutorial on using deferred routes, check out the following page on www.mackery.com:

http://www.mackery.com/routing/deferred_routes

Upgraded Dependencies

A few gems have been upgraded as part of this release, the big ones include DataMapper to 0.9.7, ActiveRecord to 2.2.2, and Haml to 2.0.4.

Changelog:

  • [#237] Fixed render :rjs throws errors
  • [#236] Upgraded to ActiveRecord 2.2.2
  • [#235] Upgraded to DataMapper 0.9.7
  • [#230] Upgraded to facets 2.4.5
  • [#229] Upgraded to english 0.3.1
  • [#227] Removed WEBrick logging
  • [#226] Bundled gems.
  • [#225] Removed dependency on Thin
  • [#223] Fixed mackery console fails
  • [#148] Added button_to_remote helper method.
  • [#16] Added deferred? routes.
  • gem: active_record 2.2.2
  • gem: data_mapper 0.9.7
  • gem: addressable 2.0.0
  • gem: facets 2.4.5
  • gem: english 0.3.1
  • gem: rspec 1.1.11
  • gem: haml 2.0.4

Building Distributed Applications from RubyConf 2008

Saturday, November 29th, 2008

Confreaks has recently published the videos of all the presentations from this year’’s RubyConf, including the presentation yours truly did on ‘Building Distributed Applications’.

http://rubyconf2008.confreaks.com/building-distributed-applications.html

There are plenty of other great talks on the site, so sit back, make some popcorn, and enjoy some of the wonderful talks that were on offer down in Florida this year.

Configatron 2.1.6 Released!

Friday, November 21st, 2008

Thanks to Matthew A. Brown for his contribution to the Configatron library. He added the ability to ‘lock’ down a namespace. Configatron has had a protect method for a while, but that only locks down a specific configuration. With lock you can lock down the whole namespace and prevent everything in that namespace from being altered. Maybe some code will help you understand:

When you get a chance checkout Mat’s Github page, http://github.com/outoftime. Thank you very much Mat for your contribution.

How to use a non-singleton version of Configatron

Thursday, November 20th, 2008

Since Configatron has come out it’s become a pretty popular library, and because of that I’ve received several feature requests. Nothing wrong with that. I actually welcome that, because, let’s be honest, that’s how configatron will become even better.

The biggest request I’ve received is from people who want to use Configatron, but they want their own instance of it, and not the global singleton instance of it. Although, I personally don’t see why you would need that, I’m a big enough man to understand that just because I don’t need it, doesn’t mean others don’t.

Last night I was reviewing the code, because I was asked this question again, and in doing so I realized that power has been there all along. It’s actually very simple. When you make a call on Kernel#configatron it returns a singleton of the Configatron class, but after that all it does is return an instance of the Configatron::Store class. So if you want your own instance of Configatron, what you really want is an instance of the Configatron::Store class, which you can do like so:

 

Well, there you go, I hope that helps. Enjoy.