|
That would be an uber-generate-controller script Maybe it's even better to just improve the generate-all command. Something like: generate-all Book --> Generates controller and views for the Book domain class generate-all * --> Generates controllers and views for all domain classes generate-all Book Author --> --> Generates controller and views for both the Book and Author domain class I've attached UberGenerate.groovy which does the generate-all for all the domain classes. It's based on the mentioned blog entry but I cleaned it up a lot. You can now use: grails generate-all "*"
or grails generate-all and just press return when prompted for a name. Note that the quotes in the first command line are there to prevent "shell globbing", otherwise the shell will process the wildcard and add all the files in the current directory as command arguments! This actually works, Peter, but not for Hibernate Annotated files in the src/ directory, only for .groovy classes in the domain/ directory. Is it supposed to be like this? How can you generate all for your hibernate configured files? Test case: <session-factory> </session-factory> And a corresponding annotated Book class. |
||||||||||||||||||||||||||||||||||||||||||||
I feel that for demo purposes it would be even better to not use generate-all (static scaffolding) but only generate the controllers with dynamic scaffolding. That way one can evolve the domain-model on stage and any changes are instantly reflected in the running app without any need for re-triggering the generation.