[Nitro] Better diagnostics for gen

gabriele renzi surrender_it at yahoo.it
Tue Apr 25 07:23:00 EDT 2006

Hi people,

I noticed working on a friend's box that the current exception handling 
tends to swallow too much information.

The problem is that in gen/bin/gen the block:

   require "gen/#{generator}/gen.rb"
rescue LoadError
   puts 'Cannot load the specified generator!'
   exit 1

won't notice the difference between a non existing generator and a 
LoadError raised in the generator file (friend's problem was related to 
a corrupted install of facets).

Maybe there could be a more explanative message, i.e.

   require path
rescue LoadError =>e
   if e.message[/#{path}$/]
    reason=  %{\tno such generator "#{generator}"}
     reason= %{\tunmet dependency loading "#{path}":\n\t#{e.message}}
   puts "Cannot load the specified generator!"
   puts reason
   exit 1

I think spitting out the available generators is not meaningful as of 
now, but if Brian's suggestion of model/scaffold generators is going to 
be applied I think it would be nice to also show the list in the first 

More information about the Nitro-general mailing list