create-mvc

Purpose

The create-mvc command will create a new MVC triad and configure it at Application.groovy. It will also create a test case for its controller.

Examples


griffon create-mvc foo

Description

MVC groups are the basis for Griffon's MVC implementation. Refer to the MVC Pattern Overview to know more about MVC groups and their features. Calling griffon create-mvc foo results in the following files being created


griffon-app/controllers/FooController.groovy
griffon-app/models/FooModel.groovy
griffon-app/views/FooView.groovy
test/integration/FooTests.groovy

Application.groovy will be updated with a new group definition


mvcGroups {
    // MVC Group for "foo"
    'foo' {
        model      = 'foo.FooModel'
        view       = 'foo.FooView'
        controller = 'foo.FooController'
    }
    …
}

Usage:


griffon create-mvc [name]

Arguments:

Options:

More Examples:


griffon create-mvc foo -group=Custom

Creates a new group definition where MVC member templates are assumed to be CustomModel, CustomView and CustomController. Will use the default template when there's no match.


griffon create-mvc foo -view=Dialog

Creates a new group definition overriding the default template for the View only.


griffon create-mvc foo -skip-controller=true

Creates a new group definition without a Controller. The configuration will look like this


mvcGroups {
    // MVC Group for "foo"
    'foo' {
        model      = 'foo.FooModel'
        view       = 'foo.FooView'
    }
    …
}


griffon create-mvc foo -with-controller=foor.BarController

Creates a new group definition with another Controller class. The Controller is assumed to exist, a file will not be created for it. The configuration will look like this

bc. mvcGroups { // MVC Group for "foo" 'foo' { model = 'foo.FooModel' view = 'foo.FooView' controller = 'bar.BarController' } … }