GithubHelp home page GithubHelp logo

tuplejump / play-yeoman Goto Github PK

View Code? Open in Web Editor NEW
238.0 238.0 57.0 1.33 MB

Play + Yeoman integration sbt and play plugins

License: Apache License 2.0

Scala 23.15% HTML 16.90% JavaScript 16.37% ApacheConf 41.18% CSS 2.41%

play-yeoman's People

Contributors

gitter-badger avatar jlitola avatar kompot avatar magro avatar pschulz avatar pulse00 avatar rajish avatar samzilverberg avatar shiti avatar ties avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

play-yeoman's Issues

Play run works fine, but using start script generated by "stage" task returns empty screen

Hi,

thanks for this plugin, with "play run", the workflows of play and grunt integrate nicely.

play run

followed by pointing a browser to localhost:9000/ui/ works as expected.

However, taking as an example the yo-demo app (I also tried with a freshly scaffolded "yo angular" app under folder /ui"), doing the following gives problems:

play clean compile stage
./target/universal/stage/bin/yo-demo

gives this output:

Play server process ID is 78065
[info] play - Application started (Prod)
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000

But on localhost:9000/ui/ I get a blank screen.
On firefox or Chrome I get a blank screen together with 404 not found:

GET http://127.0.0.1:9000/ui/ [HTTP/1.1 404 Not Found 4ms]

Note that normal scala template views show under their respective url, so localhost:9000/oldhome for example with yo-demo works fine.

Am I doing something wrong or is this a bug?

Thanks!

Additional information:

play 2.2.1 built with Scala 2.10.2 (running Java 1.7.0_10)
sbt.version=0.13.0
#in plugins.sbt:
addSbtPlugin("com.tuplejump" % "sbt-yeoman" % "0.6.3")

Cannot resolve build.sbt

Unable to resolve build.sbt

error: object Project is not a member of package play
play.Project.playJavaSettings ++ Yeoman.yeomanSettings
^

Here is the full content of build.sbt:

//import play.Project._
import com.tuplejump.sbt.yeoman.Yeoman

name := """chris-application"""

version := "1.0-SNAPSHOT"

//playDefaultPort := 8080

resolvers += "Sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

libraryDependencies ++= Seq(
javaJdbc,
javaEbean,
cache,
"org.webjars" %% "webjars-play" % "2.3.0-3",
"org.webjars" % "bootstrap" % "3.3.2-1",
"com.typesafe.slick" %% "slick" % "2.1.0",
// "org.slf4j" % "slf4j-nop" % "1.7.7",
"mysql" % "mysql-connector-java" % "5.1.31",
"com.h2database" % "h2" % "1.4.180",
"com.github.nscala-time" %% "nscala-time" % "1.2.0"
)

play.Project.playJavaSettings ++ Yeoman.yeomanSettings

playScalaSettings

Yeoman.withTemplates

net.virtualvoid.sbt.graph.Plugin.graphSettings

fork in run := true

scalaVersion := "2.11.5"

build.properties:
sbt.version=0.13.5

plugins.sbt:
// Comment to get more information during initialization
logLevel := Level.Warn

// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"

// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.8")

addSbtPlugin("com.tuplejump" % "sbt-yeoman" % "0.7.1")

addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.7.4")

I am guessing this concerns resolving dependencies but have no idea what goes wrong exactly.
Any help would be appreciated.

Can not stage project

Steps to reproduce:

git clone https://github.com/tuplejump/play-yeoman/
cd yo-demo
sbt
update
npm install
bower install
grunt
stage
(exit sbt)
cd <stage dir>
./bin/yo-demo

server launches, but http://localhost:9000/ui/#/ displays empty screen, seems that html/js/css resources were not deployed.

How could this be fixed?

Windows 8 support?

Hello I am new to play + scala :). Yoeman works locally.

Anyhow I have set things up, I guess, and have followed the instructions.

Here is the print screen which contains everything about my problem. http://prntscr.com/1i7rrx

Thanks a lot in advance. ๐Ÿ‘

Please add a developer guide

Hi,

I'd like to add some patches to this as it's a great plugin for my current project. The problem is I'm not a SBT expert and can't find a way to build this project from scratch and run my play app against a dev build. For the time being, I just used the plugin sources as a part of my play app.

Could you please provide a developer guide for this plugin? How does one build it (SBT plugin & the play app part)? How do I push it to my local ivy repo? (similar to "mvn install")

Having this will be great!

issues with play routes vs. ng-router

having a problem getting play-yeoman to play nice.

i have my routes set up as per the demo - with my json routes under /api and everything else under /ui.

However when i try to call /api/fixtures (a valid route) directly in the browser i get the message

cannot GET /api/fixtures

if i disable the plugin and comment out the routes all is well. Can you tell me how i can get this working? is there something obvious i should be checking?

One thing i've noticed is if the play application runs on 127.0.0.1:9000 and i call the /api/fixtures url using the localhost domain it works...

Interactive sbt shell won't accept keyboard input on Mac

Similarly to #21, the interactive commands seem to be broken on Mac OS X too.

Steps to reproduce: Open Terminal app on Mac OS X 10.9.4, fire up sbt and enter "yo webapp" watch cursor keys get mangled

yo --version && bower --version && grunt --version
1.2.1
1.3.9
grunt-cli v0.1.13

Unable to load Project definition : [error] (such annotations are only allowed in arguments to *-parameters)

val main = play.Project(appName, appVersion, appDependencies).settings(
// Add your own project settings here

resolvers += "JBoss repository" at "https://repository.jboss.org/nexus/content/repositories/",
resolvers += "Scala-Tools Maven2 Snapshots Repository" at "http://scala-tools.org/repo-snapshots",
resolvers += "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository",
resolvers += "sonatype-snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
resolvers += "sonatype-releases" at "https://oss.sonatype.org/content/repositories/releases",
resolvers += "java-net" at "http://download.java.net/maven/2",

Yeoman.yeomanSettings : _*

)

gives me

[error] /home/arindam/play-angular/project/Build.scala:29: no `: __' annotation allowed here
[error](such annotations are only allowed in arguments to *-parameters)
[error] Yeoman.yeomanSettings : __
[error] ^
[error] one error found
error Compilation failed

Scala Templates not being processed by Grunt

@kompot @jtammen

This is following the comment -
#12 (comment)

Don't know whether I did something wrong or it's not there - when running ~run everything works ok, but after dist I see the same template, without being processed by Grunt.

I mean blocks like

are the same in production templates after dist task.

Am I missing anything?

Seems like there is hard coded app dir in this code
https://github.com/tuplejump/play-yeoman/blob/develop/sbt-yeoman/app/com/tuplejump/sbt/yeoman/Yeoman.scala#L102-L108
that should be changed to dist when running in production?

I am assuming that you have index.scala.html and it is getting compiled as a play view but not being processed by Grunt? Is my assumption correct?

Can you share a sample app for me to try out and debug the issue?

Unable to use `Gruntfile.coffee` as the gruntfile?

When Gruntfile.coffee is used instead of Gruntfile.js as the gruntfile, play-yeoman will throw an ERROR:

Reading "Gruntfile.js" Gruntfile...ERROR
Fatal error: Unable to find "/Users/hanfeisun/Documents/waycanon/ui/Gruntfile.js" Gruntfile.

I think Grunt support to use coffeescript as the gruntfille natively, is it possible for play-yeoman to support this..

Every new .js file needs to be minified and added manually

Is there a way to add automatically newly added .js file to the main page with Minification or based on the required .js object

without any user interpretation, so that user should not be worried of minifing and adding the .js every time

Remove dependency on LiveReload browser plugin

Currently we need LiveReload browser plugin to enable live reload for our application. All liveReload Plugin does is add the livereload.js served by the yeoman/grunt live reload server in the page.

We should be able to do this in the play before serving the html.

dependence on successful grunt build

Hello,

currently the play stage or dist task executes the grunt process, waits for it, but irrespectively whether that process succeeded or failed continues on to package the application.
Is there a way to at least optionally configure this plugin to fail and stop when grunt fails? If grunt fails that's an indication that something in the code is wrong or tests failed, and that means the overall build should fail - especially in the context of continuous integration and deployment - I don't want to deploy a broken new version when there are problems in the build.

Thanks for your work, is has proved very valuable so far.

Heroku deployment

Being dependent on node, npm etc... to actually perform the build make projects using play-yeoman to not build on Heroku with their standard Scala sbt based buildpack.

I quickly hacked a buildpack mixing in all the dependencies to get a play-yeoman based project running on Heroku.

It is highly experimental and may not work for your project. Use it at your own risk.
Thought it may be useful or a starting point for others.

If you are deploying to Heroku or other buildpack based PAAS and think it's worth improving we could create a real custom buildpack and publish it once is tested and proves itself useful.

https://github.com/47deg/heroku-buildpack-scala

Make app directory configurable

I'm in the process of upgrading from 0.6.4 to snapshot play 2.3 and noticed that the app directory is no longer app but dist. I think this should be configurable so that the need to recreate the withTemplates setting from an old project doesn't need to be done.

java.lang.NoSuchMethodError: play.core.DynamicPart

With play-2.10 and sbt-yeoman-0.5.2 Iยดm getting this error msg on first request:

! Internal server error, for (GET) [/ui/] ->

java.lang.NoSuchMethodError: play.core.DynamicPart.<init>(Ljava/lang/String;Ljava/lang/String;Z)V
    at yeoman.Routes$.yeoman$Routes$$com_tuplejump_playYeoman_Yeoman_at0$lzycompute(routes_routing.scala:32) ~[play-yeoman_2.10-0.5.2.jar:0.5.2]
    at yeoman.Routes$.yeoman$Routes$$com_tuplejump_playYeoman_Yeoman_at0(routes_routing.scala:32) ~[play-yeoman_2.10-0.5.2.jar:0.5.2]
    at yeoman.Routes$$anonfun$routes$1.applyOrElse(routes_routing.scala:47) ~[play-yeoman_2.10-0.5.2.jar:0.5.2]
    at yeoman.Routes$$anonfun$routes$1.applyOrElse(routes_routing.scala:44) ~[play-yeoman_2.10-0.5.2.jar:0.5.2]
    at scala.PartialFunction$Lifted.apply(PartialFunction.scala:218) ~[scala-library.jar:na]
    at scala.PartialFunction$Lifted.apply(PartialFunction.scala:214) ~[scala-library.jar:na]

Seems to be a version issue?

Watch tasks and injectors

I am using grunt with a watch task to automatically inject new angular.js files into the project. I cannot get it to work with play-yeoman. How do I do this?

error on stb run

after typing stp run I'm getting:

Loading "imagemin.js" tasks...ERROR

Error: Cannot find module 'imagemin-gifsicle'

and browser is unable ro get angular.js file...

How to intercept all calls to /ui (security, Java)?

I am using play-yeoman (0.5.2) in a Play! 2.1.X-based Java project and my UI app is completely non-public, which means users have to log in before accessing the app under /ui. I am using play-authenticate and Deadbolt 2 for authentication and authorization.

My question: what would be the best way to achieve that, ideally without having to modify the original Yeoman controller?

Obviously, I do have near to no experience in Play! Scala, so I was naively trying to re-use the Yeoman.index action in my Java controller (which would be equipped with the appropriate @Restrict annotation), but that did not work because I did not find a way to transform a Action<AnyContent> to a play.mvc.Result ...

Thanks for any hints!

Cannot run play app on Windows if this plugin is active

E:\PlayLearn>play run
[...]
[error] java.io.IOException: Cannot run program "grunt" (in directory "E:\PlayLearn\ui"): CreateProcess error=2, Das System kann die angegebene Datei nicht finden

E:\PlayLearn>whereis grunt
Found at C:\DOKUME1\pschulz\Anwendungsdaten\npm\grunt
Found at C:\DOKUME
1\pschulz\Anwendungsdaten\npm\grunt.cmd

E:\PlayLearn>grunt -version
grunt-cli v0.1.9

I'm still on Windows XP.
The project depends on play 2.1.2 at the moment.
As you can see above, grunt is available, also in the systems path environment.
Any clue how to get it started?

SBT Load Error on adding play-yeoman to a project having incremental compilation with name hashing enabled

Hello,
Firstly, thanks for the great library that eases building SPAs with play backend.

On a project which had play-yeoman, I tried to enable the improved incremental compiler with name hashing that is available from SBT 0.13.2-M1.
Unfortunately, i get an error on loading of the play project

I have created a skeleton play project to reproduce the issue at https://github.com/diwa/play-yeoman-incremental-compiler-error

โžœ  play-yeoman-incremental-compiler-error git:(master) play
[info] Loading project definition from /Users/xyz/code/error/play-yeoman-incremental-compiler-error/project
/Users/xyz/code/error/play-yeoman-incremental-compiler-error/build.sbt:6: error: value withNameHashing is not a member of sbt.inc.IncOptions
incOptions := incOptions.value.withNameHashing(true)
                               ^
[error] Type error in expression
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?

cc - @gkossakowski

/ui/ not redirecting to /ui/app. thinks is /ui/scripts when should be /ui/app/scripts

Config File:

https://gist.github.com/5789063

Simple Controller

https://gist.github.com/5789075

When loading Yeoman.index it tries to load /ui/scripts/.... instead of /ui/app/scripts.

It has to be /ui/ and adding /app would be wrong since during production it has to dynamically change to /ui/dist instead of /ui/app

Thanks

Here is also a copy paste of the config for your convenience

Routes

This file defines all application routes (Higher priority routes first)

~~~~

GET / com.tuplejump.playYeoman.Yeoman.redirectRoot(base="/ui/")
GET /ui/ com.tuplejump.playYeoman.Yeoman.index
-> /ui yeoman.Routes

controllers

GET /foo controllers.Application.index

yo angular fails with IOException: Resource temporarily unavailable

Following the instructions, at the "yo angular" step, it starts working, but then fails with the following error:

[email protected] node_modules/grunt-contrib-connect
โ”œโ”€โ”€ [email protected]
โ”œโ”€โ”€ [email protected]
โ””โ”€โ”€ [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], cooki[waitforgo2] $ [error] java.io.IOException: Resource temporarily unavailable
[error] Use 'last' for the full log.
[waitforgo2] $ [error] java.io.IOException: Resource temporarily unavailable
[error] Use 'last' for the full log.

Heroku support?

Is it possible to deploy a project using this to Heroku? I can't see any way to build it in a compatible fashion.

Not able to conect to the scala object,

Hi ,

I am new to this, I am building the app using windows 7 OS,
Microsoft Windows [Version 6.1.7601]
npm -v ---------- 1.3.11

but will, i want to bring data to bring from the server using scala object with Play 2.2.0 ,
I am unable to get the data from scala object,

Error : http://localhost:9000/user 404 not found
http://localhost:9000/user/1 404 not found

My 'routes~' contains the

GET /user controllers.Users.index()
GET /user/:id controllers.Users.edit(id: Long)
POST /user/:id controllers.Users.save(id: Long)
DELETE /user/:id controllers.Users.remove(id: Long)

If I try to add the above line in 'routes'

[error] .....\conf\routes:18: ReverseUsers is already defined as class ReverseUsers
[error] GET /user controllers.Users.index()
[error] .....\conf\routes:18: ReverseUsers is already defined as class ReverseUsers
[error] GET /user controllers.Users.index()
[error]........\conf\routes:18: ReverseUsers is already defined as class ReverseUsers
[error] GET /user controllers.Users.index()
[error] three errors found
error Compilation failed

Run `npm install && bower install` within `activator run`

For easier deployment to Heroku, would it be possible to run npm install && bower install automatically when activator run activator compile or sbt dist is executed?

Current when I push my source code with play-yeoman to heroku, it will just throw an error:

Fatal error: Unable to find local grunt.

Release 0.6.3

The README mentions 0.6.3 release but it is not yet available.
Is it possible to cut a release ?

Disable "yeoman assets" (html/css/js) caching in development

The current file server (ExternalAssets) serves the files with cache set to max-age=3600, which causes the files to be served by the browser and so doesn't work very well with the livereload.

We should change this so that the yeoman resources i.e. the html, css and js files are not cached in development mode.

Using Yeoman templates as Play scala templates

Hi,
first of all thank you for this wonderful plugin as a beginning of frontend optimizations on my current project.

I'm trying to integrate it into my current workflow and got the following problem.
I'd like to have server side templating in Scala provided by Play in play-yeoman *.html files.

I see it as:

  • find some entry point/setting in Build.scala (?) to compile *.scala.html in a custom folder (not only default "app/views").
  • find another setting there (?) to switch between dev and production mode of play-yeoman (so that .scala.html would be compiled from dist/ and not from app/* when in production).

Could not find solution to either of these problems.

Maybe you've got it?

Thanks in advance,
Anton.

IOException when running the template project

Hi,

I downloaded activator and selected the template to create my project then cd to the project folder and executed ./activator run and getting the following:


--- (Running the application from SBT, auto-reloading is enabled) ---

[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
Gruntfile.js
java.io.IOException: Cannot run program "grunt" (in directory "/Users/abcd/Dev/Projects/play-yeoman/ui"): error=2, No such file or directory
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1042)
Caused by: java.io.IOException: error=2, No such file or directory
    at java.lang.UNIXProcess.forkAndExec(Native Method)
    at java.lang.UNIXProcess.(UNIXProcess.java:135)
    at java.lang.ProcessImpl.start(ProcessImpl.java:130)
    at java.lang.ProcessBuilder.start(ProcessBuilder.java:1023)
[trace] Stack trace suppressed: run last compile:run for the full output.
[error] (compile:run) java.io.IOException: Cannot run program "grunt" (in directory "/Users/abcd/Dev/Projects/play-yeoman/ui"): error=2, No such file or directory
[error] Total time: 1 s, completed Oct 15, 2013 12:01:47 AM

the path and ui directory do exist.
i am running on a mac pro with the latest java 7

Strange behavior on 0.6.3 because of some parallelization

Hi,
here are two screenshots. First is 0.6.2, second is 0.6.3.

screen shot 2014-01-14 at 7 18 57

screen shot 2014-01-14 at 7 19 50

Notice the following:

  1. In 0.6.3 SBT immediately responds with OK and only then starts to run actual task.
  2. After completing that task it does not show SBT command prompt (pressing enter does the trick).

Seems like some kind of async is performed. In this case it does not do much harm but there are scenarios (full rebuild when server code should be compiled after client) when it might.

build.sbt setting for 0.7.1

In this page: https://github.com/tuplejump/play-yeoman, I found project/Build.scala setup instructions for 0.6.4 and 0.7.1

After that, I found build.sbt usage for 0.6.4, but there is no examples about how to config build.sbt in 0.7.1.. I was wondering whether there is a different setting for 0.7.1 with build.sbt or it should be the same with the 0.6.4 one..

Setup dist/stage to be dependent on grunt

While creating the distribution for our application, we first need to run grunt. We should figure out and add grunt as a dependency to stage and dist tasks so that it runs by default.

Arrow keys don't work

When starting Yeoman in SBT with the 'yo' command, I can't use the arrow keys anymore. In SBT or Yeoman they work fine. This makes navigating between options impossible.

Platform is Mac OS X Maverick, sbt 0.13.0, yeoman 1.1.2

Publish Scala 2.11 version

Can you publish play-yeoman for scala 2.11 ? Our new play 2.3 applications are based on scala 2.11.1

Thanks.

Remove index.html in url

I'm not sure what is the proper way to get classic url.
Like "/" pointing to the ui/index.html without showing it .

Build.scala not available in play 2.2

I'm new to the play framework and stumbled upon your yeoman integration, which looks great. However, play 2.2. seems to have ditched the project/Build.scala configuration file and replaced it with a build.sbt in the root of the project.

Does anyone have a hint how to put the configuration mentioned in the readme into the build.sbt file?

This part here:

  val main = play.Project(appName, appVersion, appDependencies).settings(
    // Add your own project settings here
    Yeoman.yeomanSettings : _*
  )

which i assume should be integrated somehow into the build.sbt file:

name := "play-jbook"

version := "1.0-SNAPSHOT"

libraryDependencies ++= Seq(
  javaJdbc,
  javaEbean,
  cache
)

play.Project.playJavaSettings


Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.