Reputation: 34854
Is there scaffolding generator utility for Play Framework 2 for Scala like Ruby on Rails has? I found some topics about this but didn't figure out which one was most popular or even if there was the standard one?
Your thoughts?
UPDATE: I mean scaffolding for generating controllers, views, models or any of them.
Upvotes: 14
Views: 2443
Reputation: 3468
Giter8 will do most of the work for you.
You can either start a new project from scratch with giter8 - https://github.com/playframework/play-scala-seed.g8 - or add the scaffolding plugin directly - https://www.foundweekends.org/giter8/scaffolding.html.
From https://www.playframework.com/documentation/3.0.x/NewApplication :
sbt new playframework/play-scala-seed.g8
(add --branch 2.9.x
if you want a specific version rather than the latest)From https://www.foundweekends.org/giter8/scaffolding.html :
addSbtPlugin("org.foundweekends.giter8" % "sbt-giter8-scaffold" % "X.XX.X")
Inside an sbt shell, run g8Scaffold <TAB>
to view available scaffolds, or g8Scaffold <name of template>
if you already have a template in mind which you want to use. If you use the --force
option it'll overwrite your existing files - this can be useful, but beware that it'll also potentially overwrite your existing routes file(s).
Upvotes: 1
Reputation: 2789
Slick can generate models from your database tables. They aren't play specific so I think you'd have to write controllers yourself, but it's a start.
Upvotes: 0
Reputation: 12850
If you're using MongoDB, the reactive mongo plugin has an auto source feature, which gives you a REST scaffolding API:
http://mandubian.com/2013/06/11/play-autosource/
Upvotes: 0