views:

134

answers:

1

Has anyone used both:

Boson: http://tagaholic.me/2009/10/14/boson-command-your-ruby-universe.html

and

Thor: http://github.com/wycats/thor

Thor are very popular and have more followers and contributers than Boson, but Boson looks far more powerful than Thor and the architecture is very well thought out.

In Boson you:

  • can add methods that are used both in the console and ruby environment. So you don't have to both have Thorfiles for console and gems for ruby.
  • can have aliases.
  • don't have to install your script files, you just put them in ~/.boson/commands. I always have to struggle with uninstalling and installing Thorfiles after each update (which could be every minute when editing the source code, very frustrating).
  • have much nicer commands output than thor.
  • don't have to write the argument descriptions by hand like in Thor.
  • work with modules, which are better than with classes cause you can include modules inside other modules.
  • wrap open source snippets (eg. from Gist) inside a module automatically and it works with Boson immediately.
  • have different views for your method results.
  • don't have to recode anything in your snippets to fit Thor, since it only use native ruby code (modules). That means if you one day don't want to use Boson, you don't have to recode everything, which you have to if you are using Thor.
  • The API http://rdoc.info/github/cldwalker/boson is more well documented - like tutorials inside each class.
  • You can just include the "boson" modules inside your ruby script and use them directly, something I cannot with Thor, cause it is only for Thor. You can't share the Thor methods with other Thor classes (not as mixins)

I noticed all these benefits just from reading the documentation and played with Boson for a couple of minutes.

Should I use Thor just because it's more popular (cause I can't find anything else where it shines over boson) or should I take the risk that Boson may be unmaintained after a while, since the author is the only contributor?

Although it's just one guy you see how he has managed to code in a rapid speed and with outstanding quality. Would be great if more contributers like him contributed to that library. I really hope more rubyists are going to use it cause it has a lot of potential for being THE scripting framework for all system automation. Like a Rails for the backend. And the author really helps you out very fast when you file an issue.

Thor only works for the shell (which I guess is its purpose) while boson as I see it has 3 main functionalities. It allows you to have code working in the shell, in ruby (irb and scripts) and you can have nice collections of all your Ruby codes, without modifications.

I have always wanted a framework to be my backend scripting framework, and now I don't have to reinvent the wheel. It seems that boson could be it.

Has someone used both these libraries and could share some thoughts?

+3  A: 

Disclaimer: I'm the author of boson.

I've used both and thor was what inspired me to write boson. While the two have overlapping functionality, I see them as having different goals.

Thor is a scripting framework which quickly and beautifully gives applications a commandline interface. The 116 gems (including rails) that depend on it are good evidence of that. Initially I tried using thor to manage and use snippets but after awhile, the forced namespacing, the lack of aliasing, writing redundant usage lines, and poor searching, made me realize thor wasn't optimized to manage snippets.

So I wrote boson to manage the endless number of ruby snippets I used to put in ~/bin with this philosophy in mind. At 400+ commands, I'm able to instantly find and use any ruby snippet as a full-blown executable. There are too many features to go over here, though you seem to know some of boson's strengths. As for being the sole contributor, I welcome anyone to contribute their ideas.

If there was one simple comparison to make between the two, I'd say thor is centered around creating executables for projects and apps while boson is centered around creating them for users.

Good compariosn. I'm looking forward to contribute to this project full time since it is centered along the user. I have a lot of snippets I want to use directly in the shell/console instead of copying and pasting.
never_had_a_name