Monthly Archives: May 2006

Code generation and scaffolding

With all the respect that I have for the Castle projects and team members, their are two things I don’t like about the projects.
– Visual Studio Integration rather then a command line tool
– The scaffolding

So instead of complaining, here’s what I’ve done: The Generator, mouhaha! :
To compile and run:
1. Run svn co http://svn.castleproject.org/svn/castlecontrib/generator/trunk
2. Run nant in the base directory to compile
3. Run generate to get help

It’s a fully customizable code generator written in Boo and templates with ASP style syntax. I’ve made 4 generators: controller, model, generator and scaffold.

The scaffold generator is heavily inspired by RoR, it generates real code you can modify for the controller, the views, layouts, css and tests. The CRUD views will look similar to current MR scaffold with the difference that the code is live in you project so you can add a field, color, validation, change the workflow without copy pasting for the last controller you’ve done! Plus you already got some running tests! (just 2 simple for now)

To use it :
Edit the file Generators\Config.boo to fit your project structure
run bin\generate from your project root folder.

This is a work in progress so contributions or comments are welcome.

Oh and I almost forgot, a short video: Video

20 Comments

Filed under Generator