Ramaze 2009.05 has been released. This marks a new, brighter era in the Ramaze world.
Innate
For those of you that have not been following, manveru (Ramaze lead dev) had been brewing a new web framework core called Innate since the middle of last year. As of today, Innate is pretty much done, and only sees minor updates. Innate has its own repository on github, where you can find a detailed README. Innate is built on top of Rack, the “web framework framework”, and acts as the core for Ramaze as of this Ramaze release.
Upgrade carefully
Because of this big change, Ramaze applications built with Ramaze 2009.03 or prior need non-trivial effort to port to 2009.05. As such, proceed with caution when upgrading your gem, especially on production servers. You can install multiple Ramaze gem versions side by side, and then select a specific version in your applications as follows:
require ‘rubygems’ gem ‘ramaze’, ’2009.03′ require ‘ramaze’
Install or update Ramaze with
gem install ramaze
The Ramaze team would like to apologize to those who unwittingly upgraded their Ramaze gems to 2009.04, which was essentially a beta release of the new Innate-cored Ramaze. We understand and acknowledge that it may have caused some confusion for some, since legacy apps have a high chance of not working without modification, and also since nearly all online information written about Ramaze to date covers pre-Innate Ramaze. We hope to rectify the situation with this release and announcement, and thank you for your understanding.
Documentation
As is the tradition in the Ramaze community, new code doesn’t come without a healthy dose of documentation. manveru has taken a lot of time to document the way things work in Ramaze 2009.05. Along with this release, he presents the fully updated, official online Ramaze book. It is quite detailed, and should help newcomers and old timers alike get to know the new Ramaze. Although not complete at this time, it is receiving regular updates and additions. The source of the book is open source.
manveru has also updated his Ramaze todo list tutorial to work with 2009.05.
Don’t forget that the source code repositories of Ramaze and Innate also have abundant documentation in them. Questions about Ramaze are sometimes answered by simply grepping the source code and reading the documentation, examples and tests. Consult both Ramaze and Innate source.
It’s a good idea to bear in mind that anything written about Ramaze up to March 2009 may not accurately reflect Ramaze as it stands in April 2009 and onwards.
Major changes
Below are some of the changes introduced by the advance from 2009.03 to 2009.05. Do not consider it exhaustive; you’d be better served checking other sources like the Ramaze book, and also hanging out in IRC so you can ask questions and receive live support. The mailing list is also a good way to get specific questions answered.
Content representations
Controllers can now provide one of multiple representations when responding to requests, based on conditions of your choosing. For example, this new feature lets you serve a normal response to /foo, but a JSON response to /foo.json. You can even use different templating engines for different wishes. See the content representations section of the Ramaze book and the source code of Innate::Node for more details.
Modes
Ramaze applications can now run in different modes, such as :dev and :live. You can make up custom modes since a mode is simply a nested array of Rack middleware.
Layouts
Layouts now reside in their own directory, layout/, distinct from the view/ directory. (As usual in the Ramaze world, these specific directories are only defaults.) Layout specification can also now take a code block to control when a layout is applied. See the layout section of the Ramaze book for more details.
Helpers
The old link helper’s methods (A, R and Rs) have been deprecated and replaced by Innate’s link helper’s methods: a, r and rs. They are mostly interchangeable, but the r methods can now also be called “off of” controllers:
OtherController.r( :foo, :bar, :a => :b ) #=> URI('/other/foo/bar?a=b')
The old partial helper has now been replaced by the render helper of Innate. The source code for the render helper is well-documented. Refer to it for usage syntax and examples.
Apps
Ramaze Apps have been introduced (notice the spelling with a capital A). A Ramaze App can be thought of as a namespace for controllers and options. You can thus take related controllers, and then package, distribute and reuse them with relative ease. An App is itself mapped to a path of your site, and can also use directories specific to it. Some example code:
module Forumaze class MainController < Ramaze::Controller map '/', :forumaze end class AdminController < Ramaze::Controller map '/admin', :forumaze end end app = Ramaze::App[ :forumaze ] # path on site (relative URL) app.location = '/forum' # filesystem paths relative to current dir app.options.publics = 'forumaze/public' app.options.views = 'forumaze/view' app.options.layouts = 'forumaze/layout'
With the above code, hits to http://yourdomain.com/forum would be served by Forumaze::MainController, and hits to http://yourdomain.com/forum/admin would be served by Forumaze::AdminController. Views would be taken from the directories forumaze/view/ and forumaze/view/admin. The same idea applies for static files and layouts of this App.
You can have multiple Controllers per App, and multiple Apps per Ramaze application.
ramaze binary
The ramaze binary has been updated. See ramaze --help and the ramaze command section in the Ramaze book.
Ezamar -> Etanni
The old default templating engine, Ezamar, has been replaced by the Innate equivalent, Etanni (or the more powerful Nagoro, if you choose). Ezamar templates should be forward-compatible with Etanni, but Ezamar Elements have been removed. To keep using Elements, use either Nagoro, which has Elements too, or the new render helper, which can accomplish the same thing in a different way.
Miscellany
The old start.ru Rackup file has been replaced with config.ru. This is particularly important for those of you deploying with mod_rack (Passenger).
Ramaze::Global has been removed and replaced with Ramaze.options which is intended to be a much better means of configuring Ramaze. Ramaze.options is also extensible, so you can use it for custom configuration of your applications.
Contributors
Direct contributions to the code repository for this release came from the following people (listed alphabetically, nickname in parentheses):
Innate
- Sam Carr
- Michael Fellinger (manveru)
- Ryan Grove (rgrove)
- Andreas Karlsson (jeltz)
- (Pistos)
- Tadahiko Uehara (kiko)
- TJ Vanderpoel (bougyman)
Ramaze
- Clive Crous (clive)
- Michael Fellinger (manveru)
- Ryan Grove (rgrove)
- Aman Gupta (tmm1)
- Andreas Karlsson (jeltz)
- Victor Luft
- (Pistos)
- Tadahiko Uehara (kiko)
- TJ Vanderpoel (bougyman)
Of course, all the folks who use and test drive Ramaze every day also deserve thanks, not just for using it, but also for providing valuable feedback on previous releases ramping up to this one.
As usual, we’d love to hear from long-time users and newbies alike.
Stop by and say hello in our IRC channel (#ramaze on Freenode), or ask questions on our mailing list. We know converting old Ramaze apps may be challenging for some, but we’re here to help make the transition as smooth as possible for you.
Enjoy this release, and keep on Ramazing!
Related posts:
Super stuff.
Apologies for not reviewing the release notice; totally slipped my mind. Looks good, though.
Great writeup. Thanks pistos!