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

Boson: A Next Generation Task Framework for Ruby

By Peter Cooper / October 22, 2009

boson.pngBoson is a new command/task framework for Ruby by Gabriel Horner (of Hirb fame). Gabriel seems to be trying to supersede Rake, the Ruby "make" equivalent, and from first glance Boson seems to provide many benefits from the "reinvent the wheel" philosophy.

Anyone who's built a Rakefile knows it's not the most straightforward syntax, so Boson's approach of using regular Ruby code in the shape of methods added to a module is refreshing. Tasks are methods, methods are tasks - simple. Within these methods, you can use the options helper method and passed arguments to access command line options and other data. Another feature is that while, like with Rake (or Thor), Boson can execute commands from the command line, you can also do so from IRB (the Ruby "console").

It's always a bit of a crapshoot when new tools come out in the Ruby world. Some catch on, some don't. Gabriel has clearly put a lot of thought into Boson, though, so if enough people are fed up with using Rake for command launching, I think it could catch on. Gabriel's blog post outlines what Boson does perfectly. For those ready to shoot down Rake, though, don't forget to read John Barnette's awesome, recent On Rake post. Rake's not just about launching tasks - it's a killer dependency resolution engine at heart, and that can result in less code if you approach your problems the right way.

(Aside: Sorry for the slow week at Ruby Inside. Six days ago my wife gave birth to our daughter and since she had a C-section, I'm playing housewife. I have quickly discovered if you're a housewife - or husband! - you have about zero hours left at the end of the day to do any other work.. I shall try my best!)

rupho.png[ad] Mobile Orchard's from Rubyist to iPhone programmer in 2 days class is coming to Portland/OR Nov 12-13 and Los Angeles/CA Nov 19-20. $1200 $799 with early reg and "inside" discount code. Note that the early registration price ends tomorrow - 10/23!

Comments

  1. Stephen Stillwater says:

    Thanks for the post, Peter. Best to you and your wife!

  2. cldwalker says:

    Peter, thanks for the post. I'm not trying to supersede Rake which I think is awesome for rule and dependency based tasks. Boson is more geared towards creating tasks that behave like shell commands i.e. ones that handle options and have integrated help. More Boson posts for those who are interested: http://tagaholic.me/2009/10/19/how-boson-enhances-your-irb-experience.html and http://tagaholic.me/2009/10/15/boson-and-hirb-interactions.html

    Congrats on the daughter!

  3. Rob C says:

    Congratulations on the baby, I am the father of 3 c-sections... my thoughts go out to you and yours. I'll be hoping for a speedy recovery, and thanks for all of the excellent content.

  4. type says:

    it is interesting.
    and,Can it a "bosonlib" like "rakelib",not just in ~/.bason?

  5. Mike Woodhouse says:

    After a week it's time to wean them off the morphine and get them back to work. That old "I had major abdominal surgery" excuse wears thin after a while. (Don't tell my wife I said that).

  6. Guoliang Cao says:

    Peter, congratulations!

    I have Gabriel's post opened since yesterday. Now you gave me another reason to finish reading it ;-)

  7. Hongli Lai says:

    "Anyone who's built a Rakefile knows it's not the most straightforward syntax"

    I don't know what you're talking about. When I first saw Rake I noticed that it's exactly like make, except I can execute arbitrary Ruby instead of shell commands. The concept and syntax was as straightforward as I think it can possibly be.

    And congratulations by the way! But I suppose you've already seen our card. ;)

  8. Tj says:

    Thor sucks, we dont need more stuff like that

  9. Mike Danko says:

    And what do you do besides be the housemaid and smile while completely sleep deprived with grumpiness prevailing? Smile and enjoy it all of course. I'm about to be the housemaid again in December myself, and I feel for ya, but enjoy it while you can before toddlerhood.

  10. cldwalker says:

    @type: A future release could have better support for local libraries. Feel free to drop it as an issue at http://github.com/cldwalker/boson/issues

    @Hongli Lai: Agreed. Here's Boson's motivation/philosophy: http://tagaholic.me/2009/10/19/how-boson-enhances-your-irb-experience.html#organization_and_philosophy

    @Tj: Although somewhat inspired by Thor, Boson is quite a different beast.

Other Posts to Enjoy

Twitter Mentions