Generator script
Since 1.3
Overview
The generator script, bin/generate.erl is an escript that is responsible for preparing the most common modules' skeletons. At this moment it supports two types of operations: creating controller or model modules. Generator script, apart of building the Erlang modules with code scaffolds, updates also the application .app file.
It is possible to pass the parameters to the escript in two ways:
- as an argument from the shell, that is:
$ ./bin/generate.erl TYPE --argument_name argument_value
- by typing the value when one is prompted for it:
$ ./bin/generate.erl TYPE Name of the application:
Generating controller module
In order to add the controller module one must run:
$ ./bin/generate.erl controller
This command accepts the following options:
--app - name of the application we want to add the module to
--name - name of the controller module we want to create
--functions - a list of function names we want to export from the controller module. Function names are separated by the commas. Note that when using the script parameters there must not be any white spaces between the names (fun1,fun2,fun3 instead of fun1, fun2, fun3)
The result of running the command is a creation of the lib/APPLICATION_NAME/src/NAME.erl file, together with the .app file update.
Generating model module
In order to add the model module one must run:
$ ./bin/generate.erl model
This command accepts the following options:
--app - name of the application we want to add the module to
--name - name of the controller module we want to create
--hrl - name of the header file we want to include (model definition). By default it is set to NAME.hrl
The result of running the command is a creation of the lib/APPLICATION_NAME/src/wtype_NAME.erl file, together with the .app file update.
