[Nitro] Generating scaffolding / stub codes?

Bryan Soto bryan.a.soto at gmail.com
Tue Feb 21 21:05:27 EST 2006

On 2/21/06, James Britt <james_b at neurogami.com> wrote:
> S P Arif Sahari Wibowo wrote:
> > Hi!
> >
> > I have a newbie questions: is there a way in Nitro to generate
> > stub / scaffolding codes (like generate scaffold in Rails)?
> > Basically it generate a template-based views and controller
> > codes based on the model.
> Yes and no.  The "no" part is that Nitro (gen, actually) only knows one
> trick: "gen app"

Sadly, that's not exactly true. It also in theory understands gen form.
Unfortunately, it appears to have shipped broken in 0.28.0. And doesn't
appear to be documented in the usage either.

If you are interested in using it, it's a simple fix. From the ruby
installation directory,

Search for Nitro::FormMixin and change it to Nitro::FormHelper.

Sample command line is:

$ gen form file_containing_model_to_scaffold Optional_class_name_here


$ gen form models/user.rb User _user.xhtml

It's outputs the xhtml form that would represent the object and can probably
be called via render in your pages. It doesn't generate whole pages for you.

On the other hand, I wrote my own controller stub generator with very
> little effort.
> Perhaps there should be a way for people to submit their own generators
> for possible inclusion in future releases.

If you're interested in submitting them, please just email them here. :)
It's not exactly a formal process, but it could be a nice way to pioneer

Or if you'd rather not, could you describe a few things that you've
automated in addition to controllers?

I'd really like a way for me to bundle up my custom generators as a gem,
> so others can install it if they like, with the new generator callable
> from the gen tool.  Or teach gen to fetch custom generators from a URL,
> perhaps as the Rails folks have done for their community-created plug-ins.

Re: gems;

Looking at the gen script, it seems that if you follow the directory
structure gen/#{generator}/gen.rb, or to use your controller generator as an


# gen controller params_go_here

would actually find it now thanks to how Rubygems works. Completely untested
though. Of course you'd potentially have a lot of collisions if it caught on
so some formal system would have to be worked out. I'd imagine that's why
the Rails folk went with the plugin idea?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/nitro-general/attachments/20060221/74d67bec/attachment.html 

More information about the Nitro-general mailing list