From 35136e53c90b46852d9814fc30ea67d18c9c388c Mon Sep 17 00:00:00 2001 From: McDamon Date: Wed, 22 May 2013 15:00:26 +0100 Subject: [PATCH 1/3] #74 : dust plugin: upgrade to play 2.1, move to LinkedIn Dust.js fork, and allow for native compiler --- dust/README.md | 35 +- dust/build.sbt | 12 +- dust/project/build.properties | 2 +- dust/project/plugins.sbt | 1 + dust/sample/app/controllers/Application.java | 25 - dust/sample/app/controllers/Application.scala | 21 + dust/sample/app/views/index.scala.html | 4 +- dust/sample/build.sbt | 2 + dust/sample/conf/application.conf | 6 - dust/sample/project/Build.scala | 16 +- dust/sample/project/build.properties | 2 +- dust/sample/project/plugins.sbt | 3 +- .../public/javascripts/dust-core-0.3.0.min.js | 21 - .../public/javascripts/dust-core-0.6.0.min.js | 24 - .../public/javascripts/dust-core-1.2.3.min.js | 1 + .../public/javascripts/jquery-1.7.1.min.js | 4 - .../public/javascripts/jquery-1.9.1.min.js | 5 + .../main/resources/dust-core-1.2.3.js} | 307 +- ...{dust-full-0.6.0.js => dust-full-1.2.3.js} | 1008 +++--- .../src/main/resources/dust-full-mod-0.3.0.js | 3209 ----------------- .../scala/com/typesafe/plugin/DustKeys.scala | 2 + .../com/typesafe/plugin/DustPlugin.scala | 17 +- .../scala/com/typesafe/plugin/DustTasks.scala | 93 +- dust/src/test/resources/test.tl | 1 + .../com/typesafe/plugin/DustTasksSpec.scala | 41 + .../com/typesafe/plugin/DustTasksTest.scala | 17 - 26 files changed, 840 insertions(+), 4039 deletions(-) create mode 100644 dust/project/plugins.sbt delete mode 100644 dust/sample/app/controllers/Application.java create mode 100644 dust/sample/app/controllers/Application.scala delete mode 100644 dust/sample/public/javascripts/dust-core-0.3.0.min.js delete mode 100644 dust/sample/public/javascripts/dust-core-0.6.0.min.js create mode 100644 dust/sample/public/javascripts/dust-core-1.2.3.min.js delete mode 100644 dust/sample/public/javascripts/jquery-1.7.1.min.js create mode 100644 dust/sample/public/javascripts/jquery-1.9.1.min.js rename dust/{sample/public/javascripts/dust-core-0.6.0.js => src/main/resources/dust-core-1.2.3.js} (66%) rename dust/src/main/resources/{dust-full-0.6.0.js => dust-full-1.2.3.js} (86%) delete mode 100644 dust/src/main/resources/dust-full-mod-0.3.0.js create mode 100644 dust/src/test/resources/test.tl create mode 100644 dust/src/test/scala/com/typesafe/plugin/DustTasksSpec.scala delete mode 100644 dust/src/test/scala/com/typesafe/plugin/DustTasksTest.scala diff --git a/dust/README.md b/dust/README.md index e78c89c..49c3dd4 100644 --- a/dust/README.md +++ b/dust/README.md @@ -1,27 +1,21 @@ # Dust Plugin -This plugin provides build time compilation for [Dust](https://github.com/akdubya/dustjs) templates. - - +This plugin provides build time compilation for the LinkedIn fork of [Dust](https://github.com/linkedin/dustjs) templates. # How to install * add -play 2.0.2: - -```addSbtPlugin("com.typesafe" % "play-plugins-dust" % "1.4")``` +play 2.1: -play 2.0.1: - -```addSbtPlugin("com.typesafe" % "play-plugins-dust" % "1.0-SNAPSHOT")``` +```addSbtPlugin("com.typesafe" % "play-plugins-dust" % "1.5")``` to your plugin.sbt # How to Use -* Include dust. Note that this is not provided by the sbt plugin. It can be found here: [dust-core-0.6.0.min.js](https://raw.github.com/typesafehub/play-plugins/master/dust/sample/public/javascripts/dust-core-0.6.0.min.js) -``` +* Include dust. Note that this is not provided by the sbt plugin. It can be found here: [dust-core-1.2.3.min.js](https://raw.github.com/typesafehub/play-plugins/master/dust/sample/public/javascripts/dust-core-1.2.3.min.js) +``` ``` * Put your dust template .tl files under the ```app/assets``` directory @@ -41,10 +35,27 @@ to your plugin.sbt }); ``` +# Settings + +## dustOutputRelativePath + +Specify path relative to public assets folder to place compiled javascript templates. + +Example: + + DustPlugin.dustOutputRelativePath := "javascripts/templates/" + +## dustNativePath + +Elect to use a native Dust.js compiler (via Node) if installed. + +Example: + + DustPlugin.dustNativePath := Some("/usr/local/shared/npm/bin/dustc") # Sample -For an example, see the bundled sample app +For an example, see the bundled sample app. ## Licence diff --git a/dust/build.sbt b/dust/build.sbt index d5cd918..bb1a890 100644 --- a/dust/build.sbt +++ b/dust/build.sbt @@ -4,19 +4,17 @@ sbtPlugin := true name := "play-plugins-dust" -version := "1.4.1-09122012" +version := "1.5" organization := "com.typesafe" resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/" -libraryDependencies <++= (scalaVersion) { - case (scalaVersion) => Seq( - sbtPluginExtra("play" % "sbt-plugin" % "2.1-09092012" % "provided", "0.12", scalaVersion) - ) -} +scalacOptions ++= Seq("-deprecation") + +addSbtPlugin("play" % "sbt-plugin" % "2.1.1") -libraryDependencies += "commons-io" % "commons-io" % "2.2" +libraryDependencies += "commons-io" % "commons-io" % "2.4" libraryDependencies += "org.specs2" %% "specs2" % "1.12.3" % "test" diff --git a/dust/project/build.properties b/dust/project/build.properties index a8c2f84..9b860e2 100755 --- a/dust/project/build.properties +++ b/dust/project/build.properties @@ -1 +1 @@ -sbt.version=0.12.0 +sbt.version=0.12.3 diff --git a/dust/project/plugins.sbt b/dust/project/plugins.sbt new file mode 100644 index 0000000..f0a2e04 --- /dev/null +++ b/dust/project/plugins.sbt @@ -0,0 +1 @@ +addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.2.0") diff --git a/dust/sample/app/controllers/Application.java b/dust/sample/app/controllers/Application.java deleted file mode 100644 index b510bc0..0000000 --- a/dust/sample/app/controllers/Application.java +++ /dev/null @@ -1,25 +0,0 @@ -package controllers; - -import org.codehaus.jackson.node.ObjectNode; - -import play.*; -import play.mvc.*; -import play.libs.*; -import views.html.*; - -public class Application extends Controller { - - public static Result frame() { - return ok(index.render()); - } - - public static Result data() { - ObjectNode json = Json.newObject(); - - json.put("name", "Json"); - json.put("count", 1); - - return ok(json); - } - -} \ No newline at end of file diff --git a/dust/sample/app/controllers/Application.scala b/dust/sample/app/controllers/Application.scala new file mode 100644 index 0000000..7580d7e --- /dev/null +++ b/dust/sample/app/controllers/Application.scala @@ -0,0 +1,21 @@ +package controllers; + +import play.api.mvc._ +import play.api.libs.json._ + +import views.html._ + +object Application extends Controller { + def frame = Action { + Ok(index.render()); + } + + def data() = Action { + val json = Json.obj( + "name" -> "Json", + "count" -> 1 + ) + + Ok(json); + } +} \ No newline at end of file diff --git a/dust/sample/app/views/index.scala.html b/dust/sample/app/views/index.scala.html index a1672f8..3264d8a 100644 --- a/dust/sample/app/views/index.scala.html +++ b/dust/sample/app/views/index.scala.html @@ -6,8 +6,8 @@ Test - - + +