Permalink
Browse files

reformat source

  • Loading branch information...
1 parent 3bcc1fb commit 83f31e362413c1f48b7a7806766cd684e771d579 @pk11 pk11 committed Aug 20, 2012
Showing with 1,179 additions and 1,195 deletions.
  1. +384 −384 framework/src/anorm/src/main/scala/anorm/Anorm.scala
  2. +61 −60 framework/src/console/src/main/scala/Console.scala
  3. +1 −1 framework/src/play-test/src/main/scala/play/api/test/Fakes.scala
  4. +7 −7 framework/src/play-test/src/main/scala/play/api/test/Helpers.scala
  5. +23 −22 framework/src/play-test/src/main/scala/play/api/test/Selenium.scala
  6. +1 −1 framework/src/play/src/main/scala/play/api/Application.scala
  7. +24 −24 framework/src/play/src/main/scala/play/api/Configuration.scala
  8. +2 −3 framework/src/play/src/main/scala/play/api/Global.scala
  9. +25 −26 framework/src/play/src/main/scala/play/api/controllers/Assets.scala
  10. +4 −4 framework/src/play/src/main/scala/play/api/controllers/ExternalAssets.scala
  11. +2 −3 framework/src/play/src/main/scala/play/api/db/DB.scala
  12. +1 −1 framework/src/play/src/main/scala/play/api/db/evolutions/Evolutions.scala
  13. +2 −2 framework/src/play/src/main/scala/play/api/http/StandardValues.scala
  14. +7 −7 framework/src/play/src/main/scala/play/api/i18n/Messages.scala
  15. +1 −1 framework/src/play/src/main/scala/play/api/libs/Codecs.scala
  16. +3 −2 framework/src/play/src/main/scala/play/api/libs/MimeTypes.scala
  17. +137 −133 framework/src/play/src/main/scala/play/api/libs/concurrent/Promise.scala
  18. +3 −3 framework/src/play/src/main/scala/play/api/libs/concurrent/package.scala
  19. +141 −143 framework/src/play/src/main/scala/play/api/libs/iteratee/Concurrent.scala
  20. +18 −18 framework/src/play/src/main/scala/play/api/libs/iteratee/Enumeratee.scala
  21. +59 −59 framework/src/play/src/main/scala/play/api/libs/iteratee/Iteratee.scala
  22. +1 −1 framework/src/play/src/main/scala/play/api/libs/oauth/OAuth.scala
  23. +10 −9 framework/src/play/src/main/scala/play/api/libs/openid/OpenID.scala
  24. +18 −18 framework/src/play/src/main/scala/play/api/libs/ws/WS.scala
  25. +9 −12 framework/src/play/src/main/scala/play/api/mvc/Action.scala
  26. +26 −27 framework/src/play/src/main/scala/play/api/mvc/Binders.scala
  27. +11 −12 framework/src/play/src/main/scala/play/api/mvc/Http.scala
  28. +1 −1 framework/src/play/src/main/scala/play/core/j/JavaGlobalSettingsAdapter.scala
  29. +3 −3 framework/src/play/src/main/scala/play/core/j/JavaPromise.scala
  30. +37 −37 framework/src/play/src/main/scala/play/core/router/Router.scala
  31. +4 −4 framework/src/play/src/main/scala/play/core/server/NettyServer.scala
  32. +1 −1 framework/src/play/src/main/scala/play/core/server/Server.scala
  33. +0 −1 framework/src/play/src/main/scala/play/core/server/netty/Helpers.scala
  34. +14 −14 framework/src/play/src/main/scala/play/core/server/netty/NettyPromise.scala
  35. +6 −6 framework/src/play/src/main/scala/play/core/server/netty/RequestBodyHandler.scala
  36. +1 −2 framework/src/play/src/main/scala/play/core/utils/CaseInsensitiveOrdered.scala
  37. +2 −2 framework/src/sbt-plugin/src/main/scala/PlayAssetsCompiler.scala
  38. +25 −29 framework/src/sbt-plugin/src/main/scala/PlayCommands.scala
  39. +69 −71 framework/src/sbt-plugin/src/main/scala/PlayEclipse.scala
  40. +4 −4 framework/src/sbt-plugin/src/main/scala/PlayExceptions.scala
  41. +1 −1 framework/src/sbt-plugin/src/main/scala/PlayJvm.scala
  42. +4 −5 framework/src/sbt-plugin/src/main/scala/PlayKeys.scala
  43. +11 −11 framework/src/sbt-plugin/src/main/scala/PlayReloader.scala
  44. +4 −5 framework/src/sbt-plugin/src/main/scala/PlaySettings.scala
  45. +11 −15 framework/src/sbt-plugin/src/main/scala/jscompile/JavascriptCompiler.scala

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -32,9 +32,9 @@ object Console {
}
}
- private def interact(params: Map[String, String]):Map[String, String] = {
- params.map{e =>
- consoleReader.printString(e._1+"["+e._2+"]:".stripMargin)
+ private def interact(params: Map[String, String]): Map[String, String] = {
+ params.map { e =>
+ consoleReader.printString(e._1 + "[" + e._2 + "]:".stripMargin)
consoleReader.putString("")
e._1 -> Option(consoleReader.readLine()).map(_.trim).filter(_.size > 0).getOrElse(e._2)
}
@@ -66,13 +66,13 @@ object Console {
"APPLICATION_SECRET" -> newSecret)
}
- private def haveFun(name: String) =
+ private def haveFun(name: String) =
"""|OK, application %s is created.
|
|Have fun!
|""".stripMargin.format(name).trim
- private def addG8(g8: String) = if (g8.endsWith(".g8")) g8 else g8+".g8"
+ private def addG8(g8: String) = if (g8.endsWith(".g8")) g8 else g8 + ".g8"
/**
* Creates a new play app skeleton either based on local templates on g8 templates fetched from github
@@ -92,68 +92,69 @@ object Console {
if (path.exists) {
(Colors.red("The directory already exists, cannot create a new application here."), -1)
} else {
- val template: (String, String) = if (args.length == 3 && args(1) =="--g8") (addG8(args.last),defaultName)
- else {
- consoleReader.printString("What is the application name? ")
- consoleReader.printNewline
- consoleReader.printString(Colors.cyan("> "))
- consoleReader.putString(defaultName)
- consoleReader.flushConsole()
- val name = Option(consoleReader.readLine()).map(_.trim).filter(_.size > 0).getOrElse(defaultName)
- consoleReader.printNewline
-
- consoleReader.printString("Which template do you want to use for this new application? ")
- consoleReader.printNewline
- consoleReader.printString(
- """|
+ val template: (String, String) = if (args.length == 3 && args(1) == "--g8") (addG8(args.last), defaultName)
+ else {
+ consoleReader.printString("What is the application name? ")
+ consoleReader.printNewline
+ consoleReader.printString(Colors.cyan("> "))
+ consoleReader.putString(defaultName)
+ consoleReader.flushConsole()
+ val name = Option(consoleReader.readLine()).map(_.trim).filter(_.size > 0).getOrElse(defaultName)
+ consoleReader.printNewline
+
+ consoleReader.printString("Which template do you want to use for this new application? ")
+ consoleReader.printNewline
+ consoleReader.printString(
+ """|
| 1 - Create a simple Scala application
| 2 - Create a simple Java application
| 3 - Create an empty project
| <g8 template> - Create an app based on the g8 template hosted on Github
|""".stripMargin)
+ consoleReader.printNewline
+ consoleReader.printString(Colors.cyan("> "))
+ consoleReader.flushConsole()
+ consoleReader.putString("")
+
+ val templateNotFound = new RuntimeException("play.home system property is not set, so can not find template")
+ val fs = java.io.File.separator
+ val templateToUse = Option(consoleReader.readLine()).map(_.trim).getOrElse("") match {
+ case "1" => "scala-skel"
+ case "2" => "java-skel"
+ case "3" => "empty-skel"
+ case g8 @ _ => addG8(g8)
+ }
+ (templateToUse, name)
+ }
+ try {
+ //either generate templates based on local skeletons or use g8 templates
+ if (template._1.endsWith("-skel")) {
+ generateLocalTemplate(template._1, template._2, path)
+ (haveFun(template._2), 0)
+ } else {
+ //this is necessary because g8 only provides an option to either pass params or use interactive session to populate fields
+ //but in our case we have the application_name (and path) already
+ val defaults: Map[String, String] = Giter8.fetchInfo(template._1, Some("master")).right.toOption.map {
+ case (defaults, templates) => defaults
+ case _ => Map[String, String]()
+ }.getOrElse(Map[String, String]())
+ consoleReader.printNewline
+ consoleReader.printString(defaults.get("description").getOrElse(template._1))
+ consoleReader.printNewline
consoleReader.printNewline
- consoleReader.printString(Colors.cyan("> "))
- consoleReader.flushConsole()
- consoleReader.putString("")
-
- val templateNotFound = new RuntimeException("play.home system property is not set, so can not find template")
- val fs = java.io.File.separator
- val templateToUse = Option(consoleReader.readLine()).map(_.trim).getOrElse("") match {
- case "1" => "scala-skel"
- case "2" => "java-skel"
- case "3" => "empty-skel"
- case g8 @ _ => addG8(g8)
- }
- (templateToUse, name)
- }
- try {
- //either generate templates based on local skeletons or use g8 templates
- if (template._1.endsWith("-skel")) {
- generateLocalTemplate(template._1, template._2, path)
- (haveFun(template._2), 0)
- } else {
- //this is necessary because g8 only provides an option to either pass params or use interactive session to populate fields
- //but in our case we have the application_name (and path) already
- val defaults: Map[String,String] = Giter8.fetchInfo(template._1, Some("master")).right.toOption.map{
- case (defaults, templates) => defaults
- case _ => Map[String,String]()
- }.getOrElse(Map[String,String]())
- consoleReader.printNewline
- consoleReader.printString(defaults.get("description").getOrElse(template._1))
- consoleReader.printNewline
- consoleReader.printNewline
- // populate defaults (application_name is coming from play so that's already populated)
- val params: Array[String] = interact(defaults.filter(e => e._1 != "application_name" && e._1 != "description")).map(e=>"--"+e._1+"="+e._2).toArray
-
- val exitCode = Giter8.run(Array(template._1,"--application_name="+template._2) ++ params)
- if (exitCode == 0)
- (haveFun(template._2), exitCode)
- else
- ("something went wrong while processing g8 template", exitCode)
- }
- } catch {case ex: Exception =>
- ("Ooops - Something went wrong! Exception:"+ex.toString, -1)
+ // populate defaults (application_name is coming from play so that's already populated)
+ val params: Array[String] = interact(defaults.filter(e => e._1 != "application_name" && e._1 != "description")).map(e => "--" + e._1 + "=" + e._2).toArray
+
+ val exitCode = Giter8.run(Array(template._1, "--application_name=" + template._2) ++ params)
+ if (exitCode == 0)
+ (haveFun(template._2), exitCode)
+ else
+ ("something went wrong while processing g8 template", exitCode)
+ }
+ } catch {
+ case ex: Exception =>
+ ("Ooops - Something went wrong! Exception:" + ex.toString, -1)
}
}
@@ -11,7 +11,7 @@ import play.core.utils.CaseInsensitiveOrdered
*
* @param data Headers data.
*/
-case class FakeHeaders (val data: Seq[(String, Seq[String])] = Seq.empty) extends Headers
+case class FakeHeaders(val data: Seq[(String, Seq[String])] = Seq.empty) extends Headers
/**
* Fake HTTP request implementation.
@@ -187,18 +187,18 @@ object Helpers extends Status with HeaderNames {
def routeAndCall[T, ROUTER <: play.core.Router.Routes](router: Class[ROUTER], request: FakeRequest[T]): Option[Result] = {
val routes = router.getClassLoader.loadClass(router.getName + "$").getDeclaredField("MODULE$").get(null).asInstanceOf[play.core.Router.Routes]
routes.routes.lift(request).map {
- case a: Action[_] =>
+ case a: Action[_] =>
val action = a.asInstanceOf[Action[T]]
- val parsedBody: Option[Either[play.api.mvc.Result,T]] = action.parser(request).fold1(
- (a,in) => Promise.pure(Some(a)),
+ val parsedBody: Option[Either[play.api.mvc.Result, T]] = action.parser(request).fold1(
+ (a, in) => Promise.pure(Some(a)),
k => Promise.pure(None),
- (msg,in) => Promise.pure(None)).await.get
- parsedBody.map{resultOrT =>
- resultOrT.right.toOption.map{innerBody =>
+ (msg, in) => Promise.pure(None)).await.get
+ parsedBody.map { resultOrT =>
+ resultOrT.right.toOption.map { innerBody =>
action(FakeRequest(request.method, request.uri, request.headers, innerBody))
}.getOrElse(resultOrT.left.get)
}.getOrElse(action(request))
-
+
}
}
@@ -11,7 +11,7 @@ import org.openqa.selenium.htmlunit._
import org.fluentlenium.core._
import collection.JavaConverters._
-import java.util.concurrent.TimeUnit
+import java.util.concurrent.TimeUnit
import com.google.common.base.Function
import org.openqa.selenium.support.ui.FluentWait
/**
@@ -21,40 +21,41 @@ import org.openqa.selenium.support.ui.FluentWait
*/
case class TestBrowser(webDriver: WebDriver) extends FluentAdapter(webDriver) {
- /**
- * Repeatedly applies this instance's input value to the given block until one of the following occurs:
- * the function returns neither null nor false,
- * the function throws an unignored exception,
- * the timeout expires
+ /**
+ * Repeatedly applies this instance's input value to the given block until one of the following occurs:
+ * the function returns neither null nor false,
+ * the function throws an unignored exception,
+ * the timeout expires
*
* @param timeout
* @param timeunit duration
* @param block code to be executed
*/
def waitUntil[T](timeout: Int, timeUnit: TimeUnit)(block: => T): T = {
- val wait = new FluentWait[WebDriver](webDriver).withTimeout(timeout,timeUnit)
+ val wait = new FluentWait[WebDriver](webDriver).withTimeout(timeout, timeUnit)
val f = new Function[WebDriver, T]() {
- def apply(driver: WebDriver): T = {
- block
- }}
+ def apply(driver: WebDriver): T = {
+ block
+ }
+ }
wait.until(f)
}
/**
- * Repeatedly applies this instance's input value to the given block until one of the following occurs:
- * the function returns neither null nor false,
- * the function throws an unignored exception,
- * the default timeout expires
+ * Repeatedly applies this instance's input value to the given block until one of the following occurs:
+ * the function returns neither null nor false,
+ * the function throws an unignored exception,
+ * the default timeout expires
*
* @param block code to be executed
*/
- def waitUntil[T](block: => T): T = waitUntil(3000,TimeUnit.MILLISECONDS)(block)
-
+ def waitUntil[T](block: => T): T = waitUntil(3000, TimeUnit.MILLISECONDS)(block)
+
/**
* retrieves the underlying option interface that can be used
* to set cookies, manage timeouts among other things
*/
- def manage: WebDriver.Options = super.getDriver.manage
+ def manage: WebDriver.Options = super.getDriver.manage
}
@@ -117,11 +118,11 @@ case class TestServer(port: Int, application: FakeApplication = FakeApplication(
play.core.Invoker.uninit()
try {
server = new play.core.server.NettyServer(new play.core.TestApplication(application), port, mode = Mode.Test)
- } catch {
- case t: Throwable =>
- t.printStackTrace
- throw new RuntimeException(t)
- }
+ } catch {
+ case t: Throwable =>
+ t.printStackTrace
+ throw new RuntimeException(t)
+ }
}
/**
@@ -103,7 +103,7 @@ class Application(val path: File, val classloader: ClassLoader, val sources: Opt
router
}
} catch {
- case e: ClassNotFoundException => configuration.getString("application.router").map { routerName =>
+ case e: ClassNotFoundException => configuration.getString("application.router").map { routerName =>
throw configuration.reportError("application.router", "Router not found: " + routerName)
}
case e => throw e
Oops, something went wrong.

0 comments on commit 83f31e3

Please sign in to comment.