cldwalker / boson

A command/task framework similar to rake and thor built with extendability in mind.
http://rdoc.info/gems/boson
MIT License
218 stars 10 forks source link

How to test commands when creating them? #7

Closed michaelbarton closed 14 years ago

michaelbarton commented 14 years ago

I was wondering what you use to test boson commands when you're creating them? I've had some problems trying to identify bugs originating from the method scraping of comments since they don't throw a standard ruby stack error but appear to fail silently. For example it took me a while to track down this error - http://github.com/michaelbarton/pubmed-boson/commit/adad87c217a879c32e47c076d96730add5104172

I thought about writing small test suite for boson commands but wondered what your thoughts were first.

Thanks

Mike

cldwalker commented 14 years ago

Since method attributes like options and render_options can be commented or just regular ruby (see http://tagaholic.me/boson/doc/classes/Boson/Inspector.html), the easiest thing to do would be to uncomment what you suspect to be a syntax error. Using the link you gave as an example:

   options :email => :string, :number => 5, :year => :numeric,
     :authors => :array, :journal => :string, :terms => string
   # @render_options :fields => {
   #   ...
  def query(options={})

That would immediately fail due to the syntax error.

It would be nice to see failed method attribute scraping by adding a --debug flag to boson. Perhaps in the next release.

michaelbarton commented 14 years ago

Ok thanks. I'll use that.

cldwalker commented 14 years ago

The latest boson has a --debug which toggles displaying errors including this one.