skinny-framework/skinny-framework — pull request #205 by seratch (2014-12-05 06:19:11+00:00)
Title: Enable code generator more customizable

This PR enables customizing output directories and controller/model package names.

The following example shows how to integrate with Play Framework apps.

### build.sbt

```scala
lazy val task = (project in file("task")).settings(
scalaSource in Compile := baseDirectory.value,
libraryDependencies += "org.skinny-framework" %% "skinny-task" % skinnyVersion,
mainClass := Some("TaskRunnner")
)
```

### task/TaskRunner.scala

```scala
import skinny.task._, generator._
object TaskRunner extends SkinnyTaskLauncher {

lazy val modelGenerator = new ModelGenerator {
override def sourceDir = "app"
override def testSourceDir = "test"
override def modelPackage = "models"
}

register("generate:model", (params) => {
modelGenerator.run(params)
})
}
```

### How to run

```
$ sbt "task/run generate:model Person name:String"
...
[info] Running TaskRunner generate:model Person name:String

*** Skinny Generator Task ***

"app/models/Person.scala" created.
"test/models/PersonSpec.scala" created.

[success] Total time: 0 s, completed 2014/12/05 00:00:00
```