Merb-0.9.3 released

Posted by ezmobius Mon, 05 May 2008 02:36:00 GMT

Merb 0.9.3 is mostly (but not only) a bugfix release. We’ve not only added several features very useful for developers who want to use Merb for web services, but fixed many bugs, greatly improved spec coverage and quality, made documentation better, and did some performance-related work.

diffstat shows 95 files changed, 3359 insertions(+), 837 deletions(-)

Highlights that affect API:

==== Customize the way your models are serialized. display method use to just call to_json, to_xml on parameter without any chance to customize what’s being serialized. Now all options other than :layout and :template are passed to serializing method so you can benefit from ActiveRecord’s to_xml/to_json :except, :include and other options.

==== Passing arguments to before/after filters

You can now pass arguments through before/after filters to the underlying method using the :with option.

Example:

Method defined elsewhere
def    has_role?(role)
  current_user.has_role?(role) || current_user.is_admin?
end
In Controller
before :has_role?, :with => 'Articles'
:with => [current_user, foo, bar]

==== Polished deferred actions support

Action deferring now uses mutex smartly so Mongrel, Thin and Ebb can work with it.

==== New Merb Freezer plugin

New plugin to let you freeze Merb and other gems directly in your app. It’s a great way to package your app when you are working on edge or if you want to run multiple apps on one server but each app is working on a different version of Merb. (uses Git submodules and/or rubygem)

==== Support compisite primary keys in Datamapper for resources

:keys option has been added to resources which reflects Datamapper’s composite primary keys.

Example:

r.resources :emails, :keys => ["username", "domain"]
generates routes in the form of:
  1. # GET /posts/?(\.:format)? :action => "index" 
  2. # GET /posts/index(\.:format)? :action => "index" 
  3. # GET /posts/new :action => "new" 
  4. # POST /posts/?(\.:format)?, :action => "create" 
  5. # GET /posts/:username/:domain(\.:format)? :action => "show" 
  6. # GET /posts/:username/:domain[;/]edit :action => "edit" 
  7. # PUT /posts/:username/:domain(\.:format)? :action => "update" 
  8. # GET /posts/:username/:domain[;/]delete :action => "delete" 
  9. # DELETE /posts/:username/:domain(\.:format)? :action => "destroy" 

==== HTTP authentication

Merb has HTTP authentication in core now. So you can do

class BasicAuthentication < Merb::Controller
 before :authenticate, :only => :index

 def index
   "authenticated" 
 end

 protected

 def authenticate
   basic_authentication { |u, p| u  "Fred" && p  “secret” }
 end
end

==== Use any Rack init file you need

New -R/—rackup startup option allows you use any Rack init file you need.

==== Send file now bug-free Send file now correctly sends chunks to client.

List of small and not-so-small changes in 0.9.3:

  • Fixes to Rake tasks.
  • Spec coverage greatly improved.
  • Fix router reloading by introducing a mutex for compilation.
  • Bootloader now logs exceptions on load.
  • File streaming has been fixed.
  • _dispatch test helper now returns body of response.
  • Merb now has HTTP Basic Authentication in core based on Rack.
  • Naming issues with Datamapper 0.9 plugin are resolved.
  • url method now takes :format.
  • Cookies get cleaned when TamperedWithCookie is raised
  • thrown_content? predicate adds flexibility to templates
  • deferred? helper now works with Thin and Ebb
  • Lots of documentation improvements
  • Number of fixes and speed-ups to core extensions like snake_case
  • Merb.env? predicate to detect environemnt Merb uses.
  • Routes can be fixated now to support rich applications request params-based sessions.
  • display now has a way to customize serialization by passing some options to methods like to_json.
  • Merb now supports both memcache-client and memcached gems.
  • New—rackup options to use any rack init file you want.
  • init.rb generated by merb-gen is better organized and documented now.
  • Exception status handling now actually works.
  • —very-flat application structure now supports direct inheritance from Merb::Controller (and thus finally useful).
  • Default routes now play nicely with Datamapper composite primary keys.

So get it from rubyforge:

$ sudo gem install merb

9 comments

Comments

  1. Damian said 13 minutes later:
    Thanks very much, Ezra, that's wonderful! And to all other developers my gratitude also goes.
  2. Jakub Oboza said about 4 hours later:
    there is a small problem :) sudo gem install merb ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) OpenURI::HTTPError: 404 Not Found reading http://gems.rubyforge.org/gems/merb-action-args-0.9.3.gem 404 Not Found

    Not Found

    The requested URL /gems/merb-action-args-0.9.3.gem was not found on this server.


    Apache/1.3.33 Server at gems.rubyforge.vm.bytemark.co.uk Port 80
  3. ezra said about 5 hours later:
    that's just rubyforge lagging on syncing all the gems to the gem mirrors. Try again in a little while.
  4. Jeff Hodges said about 14 hours later:
    Great news. Any chance you can add a More link to the posts in your feed when you have more info on click through? I almost didn't see your change list.
  5. cory said about 15 hours later:
    Some info on how to use the fixation feature is here: http://www.merbes.com/2008/03/merb-route-fixation-or-uploading-from.html
  6. jd said 3 days later:
    is merbivore.com down? I haven't been able to reach for days now...
  7. ezra said 3 days later:
    nope merbivore.com is up for me and hasn't been down as far as i know.
  8. jd said 3 days later:
    Interesting. I'm located in Hungary but I doubt that would be a problem. Of course, god knows, some strange things have happened before...
  9. jd said 3 days later:
    I'm sorry I know it's completely off topic but I can't for the life of me reach the site!! Anyway, i'll be waiting for 1.0!!

(leave url/email »)

   Preview comment