Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

Rango: A New Modular Ruby Webapp Framework

By grantmichaels / December 2, 2009

Screen shot 2009-12-02 at 13.25.25Rango is a Rack-based lightweight Web framework by Jakub Šťastný that has seemingly borrowed a little bit less from past Ruby frameworks and a bit more from Django. Based on the 1.9 version of Ruby, Rango works with rvm, Rip, Usher, Warden, and both the new Gem bundler and the venerable DataMapper by default.

Philosophically, "Rango is attempting to be as agnostic as possible, valuing simple, readable code.  It intends to encourage explicit code rather than implicit magic."  Modularity is a top priority. In many ways it feels like Ramaze, but with a newer "era of Rack" foundation. There's a good "Why Use Rango" article available if you want to get a feel for the project and why you might consider using it. There's also a PDF presentation that acts as an introduction to the project.

Serving, Routing and Templates

Rango is Passenger friendly, and because Rango is designed for Ruby 1.9, using Mongrel is discouraged (although possible).  The router is pluggable and Usher is the default, but you can elect rack-router or rack-mount via the generator.  At present, Rango plays nicely with Haml, but with the upcoming 0.2 version it will adopt Tilt, which adds a number of formats, including Mustache, ERB, Erubis, and Liquid.

Rango has generators, but beyond that it employs a sub-project named "Simple-Templater" to assist developers in customizing project-specific code generation. Rango draws additional strength from "Pupu," a framework agnostic CLI (command-line interface) system which aids in managing /public directory content and functionality into modules - modules which can even include packaged javascript functionality.

Code reloading during development is made available by Shotgun, or if you are using Phusion Passenger, you can of course use tmp/always_restart.txt to restart the app at every request. If Racksh is installed, running ./init.rb -i will start it, and it falls back to Irb otherwise.

The Future

Rango has a very aggressive roadmap for December 2009, and also boasts an impressive feature timeline within the wiki.  Rango offers a number of innovative departures which seem noteworthy at present.  To get updates on the Rango project, follow @RangoProject on Twitter.

caliper-logo.png[ad] Find duplication, code smells, complex code and more in your Ruby code with Caliper! The metrics are free and setup takes just one click. Get started!

Comments

  1. Othmane Benkirane says:

    Rango sounds nice, and I'm going to use it for one of my projects as an experiment. What is the best ruby implementation for Rango ? I mean, is MRI1.9 good enough, or should I use Rubinius, or any other one ?

  2. charly says:

    Very exciting framework here, specially the (coming) mountable apps via pancake which I discovered a few days ago. Who knows, one day maybee the monkey will free me from jails!

  3. Heh says:

    It's funny to see someone refer to Rails as Jails nowadays. As a Java developer, I can safely say you don't know how good you have it in "jail"...

  4. Vladimir Sizikov says:

    Nice to see planned JRuby support during the next year! :)

  5. Botanicus says:

    Benkirane, ATM Rango is tested just with MRI 1.9.1 & 1.9.2 preview. Rubinius isn't fully 1.9 compatible. I'll support jruby soon and then other implementations.

  6. Greg Melton says:

    Oh, nice! I've been developing a similar type of Rack framework called, Doozer (http://github.com/grippy/doozer). It has a lot of the same features. I do the like how the template system is modular in that you aren't bound to only Erb (which is how Doozer works at the moment).

    Doozer has all the code generators for making controllers, views, migrations, etc. Features built-in clustering support for running multi apps (or unicorn), irb console which loads the environment, multi ORM support, and much more.

    Nice to see a different approach.

  7. slabounty says:

    Any reason someone would choose this over say Ramaze? What are the advantages/disadvantages of one over the other?

    It is nice to see more frameworks though, especially simpler ones like this.

  8. Peter Cooper says:

    I haven't taken a look at Rango's code yet, but on the surface it seems rather Ramaze-like (I edited the Ramaze mention into grantmichaels' piece) so I'd be interested to know that too.

  9. Botanicus says:

    Thanks for all the comments guys.

    Ramaze is definitely the most similar framework, but there are still quite a lot of differences. Firstly Rango is definitely much more lightweight (and it's going to stay quite lightweight) and I would say Rango is more trying to help with development in Rack than build it's own platform. Rango also likes more explicit approach and philosophy of both framework is a bit different, as far as I know.

    Also some parts of Ramaze seems to be a bit strange for me. I don't like routing in controllers (even it's just optional), the template engines coming with Ramaze, etc. Rango is also less monolithic, so it's putting everything what isn't required into separate gems. And of course, Rango has some unique features like template inheritance which are hard to just put into an existing frameworks, because even if some apps will use it, the plugins will just stay on the default solution.

    But certainly I believe Ramaze is pretty good framework, it's just not what I was looking for.

    It would be nice if @manveru or someone from Ramaze team can give some notes about it.

  10. Eliot Sykes says:

    "....attempting to be as agnostic as possible, valuing simple, readable code. It intends to encourage explicit code rather than implicit magic."

    <-- Hoping to see more of this, not a big fan of implicit magic

  11. roger says:

    Add an auto database manager like django and I'm in :)

    -r

  12. Nathan says:

    Is it just me or does rango seem to have a lot of javaisms in the code?

Other Posts to Enjoy

Twitter Mentions