Hot in Edge Rails: Generate Rails Apps from Templates

Update: Pratik covers rails templates in more detail here.

I hate to use uber-superlatives, but this is just plain frakkin awesome to the power of a Chuck Norris roundhouse-kick: Jeremy McAnally‘s rg (don’t worry if you have no clue about rg – I heard about it 10 minutes ago myself (via Pratik)) made it to the rails core.

So what the hell is rg to begin with? rg is a rails generator, like the ‘rails’ command (the one used to create a blank Rails app) just way cooler. You think it has never been easier to create a skeleton app because we have bort? Well, then check this out:

bort_template.png
(Eyes glazing over? Check it out (as well as other examples) on github).

It’s hard to believe, but the above template is able to generate a clean rails app which is basically bort (Or exactly bort. Or very similar to bort. Or similar to a bort lookalike. Or… I guess I leave this debate up to ruby lawyers, bort experts, rg zealots etc.) Anyway, it doesn’t really matter as rg was not invented to compete with bort – bort is merely used as an example because it’s probably the most popular Rails skeleton app nowadays – rg is far more general than that: an easy, concise, Rubyish way to describe your Rails app (including plugins, vendored gems, lib files, initializers and whatnot) in a very straightforward way.

There are a handful of base Rails apps out there – but the chance that one of them is *exactly* using the tools you are committed to is minimal. For example I prefer HAML to erb, SASS to CSS, jQuery to Prototype, somewhat undecided between Shoulda and rSpec, I’d like to give authlogic a spin the next time I need user authentication etc. and the list goes on and on – and it changes over time. With this addition to Rails this is no problem – it takes minutes to cook your own Rails skeleton app, and minutes to adjust it later.

If this is still not enough, check out the Jeremy’s TODO list: Save yourself the hassle of keeping your core components up to date (coming soon). OMG, I have been waiting for something like this for ages, and I doubt I am alone (though the ability to describe gems in environment.rb was a great leap forward) – this will really rock! Kudos Jeremy!

13 thoughts on “Hot in Edge Rails: Generate Rails Apps from Templates

  1. Pingback: Double Shot #344 « A Fresh Cup

  2. The next step?

    framework(:foo) do
    ruby ‘rubinius’, :git => …
    dbengine ‘mysql’, :src => ….
    orm ‘active
    record’, :src => …
    controller ‘cells + apotomo”, :git =>…
    view ‘sass, haml’, : …
    ….
    end

  3. This is pretty sweet, I think we’ll give it a whirl with our stock Facebook application builds.

    Any idea on when the “keeping your core components up to date” would be complete?

  4. Pingback: Integrate Ruby and Asterisk (Call Detail Record) Using …

  5. @MJ: No clue, just seen it on Jeremy’s TODO list (scroll to section FEAURES AND PROBLEMS). Now that it is in Rails core, I would assume as fast as possible…

  6. @peter: Probably not, I’ll most likely stick with merb for new apps. This (like engines becoming core) just seems like another of the check list for feature-matching merb.

    aahh… how the apprentice has now become the master ;)

  7. Pingback: Nome do Jogo » Blog Archive » Rails Podcast Brasil - Episódio 39

  8. Hi that were some great info. Despite im from germany and my english isnt that neat i was able to translate everything, so i enjoy your english style, because its so well organized and easy to interpret. Go on like that!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>