Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Generators

Andreas Reischuck edited this page Mar 23, 2014 · 5 revisions

The following generators are available. It’s only an overview, for more information run the generators without arguments for a help page.

Scaffold

disco generate scaffold RESOURCE [ATTR:TYPE ...]

This is similar to the rails scaffold generator. It creates a models with a migration and a projection. Also it creates commands and events for standard CRUD actions, as well as handlers for them in command processor, controller and projections.
Finally it adds a route for the resource.
Attributes are given with its type, like e.g. title:string.

Command

disco generate command COMMAND_NAME [ATTR ....] [--event=EVENT_NAME] [--processor=PROCESSOR_NAME]

This generators a command and an event with the given name. Additional it creates a command_processor if none exists and adds the code for processing the newly generated code.

The COMMAND_NAME should be something like: created_post or CreatedPost

Attributes are given WITHOUT types. Commands are stored serialized therefore the names are sufficient.

Model

disco generate model RESOURCE [ATTR:TYPE ...] [--domain]

This one creates a model, a projection and a migration. With the —domain option you can specify, that you want to create the resource for your domain.
Attributes are given with its type, like e.g. title:string.

Projection

disco generate projection NAME [EVENT EVENT] [--domain]

The final one creates a projection with methods for the events given. With the —domain option you can specify, that you want to create the projection for your domain.

Clone this wiki locally