Skip to content

Commit

Permalink
support for Play's injected routes generator
Browse files Browse the repository at this point in the history
  • Loading branch information
Shiti committed Jul 14, 2015
1 parent 875db30 commit 53f78ce
Show file tree
Hide file tree
Showing 49 changed files with 1,761 additions and 433 deletions.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ The play-compatible-version depends on the version of Playframework being used,
|---------------------------|--------------------|--------------|
| 2.2.x | 0.6.4 | 2.10 |
| 2.3.x | 0.7.1 | 2.10, 2.11 |
| 2.4.x | 0.8.0 | 2.11 |
| 2.4.x | 0.8.1 (support for injected routes generator) | 2.11 |


3) Import Yeoman classes in the project build adding the following import to `project/Build.scala`,
Expand Down Expand Up @@ -132,6 +132,17 @@ GET /ui com.tuplejump.playYeoman.Yeoman.index
-> /ui/ yeoman.Routes
```

If using, injected routes generator (0.8.1 onwards),

```
GET /ui @com.tuplejump.playYeoman.Yeoman.index
-> /ui/ yeoman.Routes
```

Optionally, you can also redirect your root url,
Expand All @@ -142,6 +153,13 @@ GET / com.tuplejump.playYeoman.Yeoman.redirectRoot(base="/ui/")
```

If using, injected routes generator (0.8.1 onwards),
```
GET / @com.tuplejump.playYeoman.Yeoman.redirectRoot(base="/ui/")
```

6) Start play/sbt in your project folder,

```
Expand Down Expand Up @@ -249,7 +267,7 @@ Using >= 0.7.1

* Once that is done play will compile the templates from yeoman directory too, and you can use them in your controllers. This helps you keep all your UI files together under the yeoman directory ('ui' by default)

* Look at the yo-demo project for details!
* Look at the yo-demo and yo-injection-demo projects for details!

Note: Starting from 0.7.1, play-yeoman supports compilation of views from the yeoman directory but cannot recompile them when they are modified with the server running. You will need to stop the server and start it again.

Expand Down
5 changes: 1 addition & 4 deletions play-yeoman/README
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
This is your new Play 2.1 application
=====================================

This file will be packaged with your application, when using `play dist`.
This application provides the controllers for the plugin
13 changes: 12 additions & 1 deletion play-yeoman/app/com/tuplejump/playYeoman/Yeoman.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,23 @@ object Yeoman extends Controller {

}

/**
* Class added to support injected route generator (Play 2.4 onwards)
*/
class Yeoman extends Controller {
def index = Yeoman.index

def redirectRoot(base: String = "/ui/") = Yeoman.redirectRoot(base)
}

object DevAssets extends Controller {
// paths to the grunt compile directory or else the application directory, in order of importance
val runtimeDirs = Play.configuration.getStringList("yeoman.devDirs")
val basePaths: List[java.io.File] = runtimeDirs match {
case Some(dirs) => dirs.asScala.map(Play.application.getFile _).toList
case None => List(Play.application.getFile("ui/.tmp"), Play.application.getFile("ui/app"))
case None => List(Play.application.getFile("ui/.tmp"), Play.application.getFile("ui/app"),
//added ui to defaults since the newer projects have bower_components in ui directory instead of ui/app/components
Play.application.getFile("ui"))
}

/**
Expand Down
9 changes: 4 additions & 5 deletions play-yeoman/project/Build.scala
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
import play.sbt.PlayScala
import sbt.Keys._
import sbt._
import Keys._
import play.Play.autoImport._
import PlayKeys._

object ApplicationBuild extends Build {

val appName = "play-yeoman"
val appVersion = "0.8.0"
val appVersion = "0.8.1"

val appDependencies = Seq(
// Add your project dependencies here,
//jdbc,
//anorm
)

val main = Project(appName, file(".")).enablePlugins(play.PlayScala).settings(
val main = Project(appName, file(".")).enablePlugins(PlayScala).settings(
version := appVersion,
libraryDependencies ++= appDependencies,
// Add your own project settings here
Expand Down
246 changes: 0 additions & 246 deletions sbt-yeoman/activator

This file was deleted.

Binary file removed sbt-yeoman/activator-launch-0.1.1.jar
Binary file not shown.
Loading

0 comments on commit 53f78ce

Please sign in to comment.