Upgrade of sbt, lift et al.
authorTomas Zeman <tzeman@volny.cz>
Mon, 02 Apr 2012 00:06:52 +0200
changeset 21 641c7190c566
parent 20 f1551f9d3d3e
child 22 94ed9cfdb123
Upgrade of sbt, lift et al.
.hgignore
.vimrc
README
build.sbt
project/Build.scala
project/build.properties
project/build/FisProject.scala
project/plugins.sbt
src/main/resources/default.props
src/main/scala/fis/base/model/BaseSchema.scala
src/main/scala/net/tz/lift/snippet/DataTable.scala
src/main/scala/net/tz/lift/snippet/Loc.scala
src/main/scala/net/tz/lift/snippet/Panel.scala
src/test/scala/fis/base/model/SeqIdPostgreSqlAdapterSpec.scala
--- a/.hgignore	Sun Apr 01 23:25:17 2012 +0200
+++ b/.hgignore	Mon Apr 02 00:06:52 2012 +0200
@@ -6,3 +6,4 @@
 lib_managed
 src/main/webapp/img/logo*.png
 tags
+pgsql
--- a/.vimrc	Sun Apr 01 23:25:17 2012 +0200
+++ b/.vimrc	Mon Apr 02 00:06:52 2012 +0200
@@ -1,6 +1,6 @@
 set backupdir=~/tmp
 set directory=~/tmp
-set tags=tags,~/scala-2.8.1.tags,~/lift-2.3.tags,~/joda-time-1.6.2.tags,~/squeryl-0.9.4-RC6.tags,~/jse6.tags
+set tags=tags,~/lift-2.4.tags,~/scala-2.8.2.tags,~/joda-time-1.6.2.tags,~/squeryl-0.9.4.tags,~/jse6.tags
 set et
 set ts=2
 set sw=2
--- a/README	Sun Apr 01 23:25:17 2012 +0200
+++ b/README	Mon Apr 02 00:06:52 2012 +0200
@@ -3,11 +3,11 @@
 Build instructions:
 
  * project is built via simple build tool
-   (http://code.google.com/p/simple-build-tool/)
+   (https://github.com/harrah/xsbt)
 
 $ sbt update
 $ sbt compile
-$ sbt jetty
+$ sbt container:start
 
 
 # vim: tw=72 et ts=2 sw=2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/build.sbt	Mon Apr 02 00:06:52 2012 +0200
@@ -0,0 +1,36 @@
+name := "fis"
+
+version := "0.2-SNAPSHOT"
+
+organization := "Tomas Zeman"
+
+scalaVersion := "2.8.2"
+
+{
+val liftVer = "2.4"
+libraryDependencies ++= Seq(
+  "net.liftweb" %% "lift-squeryl-record" % liftVer,
+  "net.liftweb" %% "lift-mapper" % liftVer,
+  "net.liftweb" %% "lift-webkit" % liftVer,
+  "net.liftweb" %% "lift-widgets" % liftVer
+)
+}
+
+libraryDependencies ++= Seq(
+  "org.mortbay.jetty" % "jetty" % "6.1.26" % "container",
+  "postgresql" % "postgresql" % "9.1-901-1.jdbc4" % "runtime",
+  "ch.qos.logback" % "logback-classic" % "0.9.29" % "runtime",
+  "org.scalatest" %% "scalatest" % "1.7.1" % "test"
+  //"com.h2database" % "h2" % "1.3.165" % "test"
+)
+
+seq(webSettings :_*)
+
+port in container.Configuration := 8081
+
+// compile options
+scalacOptions ++= Seq("-encoding", "UTF-8", "-deprecation", "-unchecked")
+
+javacOptions  ++= Seq("-Xlint:unchecked", "-Xlint:deprecation")
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project/Build.scala	Mon Apr 02 00:06:52 2012 +0200
@@ -0,0 +1,37 @@
+/*
+ * See https://github.com/retronym/scratch/blob/master/20110929/project/build.scala
+ * for details.
+ */
+
+import sbt._
+import Keys._
+
+object CmgmtBuild extends Build {
+
+  // Setting shared by all projects
+  lazy val standardSettings = Defaults.defaultSettings ++ Seq(
+  // The console analog to Defaults.mainRunTask and Defaults.mainRunMainTask
+  // Its omission from the standard settings seems to be an oversight.
+  console <<= consoleTask(fullClasspath in Runtime, console))
+
+  lazy val root = Project(
+    id = "root",
+    base = file("."),
+    settings = standardSettings
+  )
+
+  import Build.data
+  import Project.Initialize
+
+  // Copy/Paste from Defaults.consoleTask, allowing classpath : ScopedTask rather than : Task.
+  def consoleTask(classpath: ScopedTask[Classpath], task: TaskKey[_]): Initialize[Task[Unit]] = {
+    (compilers in task, classpath, scalacOptions in task, initialCommands in task, streams) map {
+      (cs, cp, options, initCommands, s) =>
+      (new Console(cs.scalac))(data(cp), options, initCommands, "", s.log).foreach(msg => sys.error(msg))
+      println()
+    }
+  }
+
+}
+
+// vim: set ts=2 sw=2 et:
--- a/project/build.properties	Sun Apr 01 23:25:17 2012 +0200
+++ b/project/build.properties	Mon Apr 02 00:06:52 2012 +0200
@@ -1,7 +1,2 @@
 #Project properties
-project.organization=net.tz
-project.name=fis
-sbt.version=0.7.5
-project.version=0.2-SNAPSHOT
-build.scala.versions=2.8.1
-project.initialize=false
+sbt.version=0.11.2
--- a/project/build/FisProject.scala	Sun Apr 01 23:25:17 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright 2011 Tomas Zeman <tzeman@volny.cz>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import sbt._
-
-class FisProject(info: ProjectInfo) extends DefaultWebProject(info) {
-
-  val liftVer = "2.3"
-
-  // lift
-  val lift_squeryl = "net.liftweb" %% "lift-squeryl-record" % liftVer
-  val lift_widgets = "net.liftweb" %% "lift-widgets" % liftVer
-
-  // logging
-  val logback = "ch.qos.logback" % "logback-classic" % "0.9.28" % "runtime"
-
-  // servlet + jetty
-  val servlet = "javax.servlet" % "servlet-api" % "2.5" % "provided"
-  val jetty6 = "org.mortbay.jetty" % "jetty" % "6.1.23" % "test"
-
-  // runtime
-  val pgsql = "postgresql" % "postgresql" % "8.4-702.jdbc4"
-
-  // testing
-  val scalatest = "org.scalatest" % "scalatest" % "1.3" % "test"
-  val h2 = "com.h2database" % "h2" % "1.2.142" % "test"
-
-  // use local mvn repo
-  val mavenLocal = "Local Maven Repository" at "file://" + Path.userHome +
-    "/.m2/repository"
-
-  /*
-  override def compileOptions = super.compileOptions ++
-    Seq(Unchecked)
-  */
-}
-
-
-// vim: set ts=2 sw=2 et:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/project/plugins.sbt	Mon Apr 02 00:06:52 2012 +0200
@@ -0,0 +1,4 @@
+resolvers += Classpaths.typesafeResolver
+
+libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % (v+"-0.2.10"))
+
--- a/src/main/resources/default.props	Sun Apr 01 23:25:17 2012 +0200
+++ b/src/main/resources/default.props	Mon Apr 02 00:06:52 2012 +0200
@@ -2,4 +2,4 @@
 
 #db.fis.user=
 #db.fis.pass=
-db.fis.url=jdbc:postgresql://localhost:7902/fis_dev
+db.fis.url=jdbc:postgresql://localhost:7803/fis_dev
--- a/src/main/scala/fis/base/model/BaseSchema.scala	Sun Apr 01 23:25:17 2012 +0200
+++ b/src/main/scala/fis/base/model/BaseSchema.scala	Mon Apr 02 00:06:52 2012 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011 Tomas Zeman <tzeman@volny.cz>
+ * Copyright 2011-2012 Tomas Zeman <tzeman@volny.cz>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -48,7 +48,7 @@
     super.create
   }
 
-  override protected def drop = {
+  override def drop = {
     val dba = Session.currentSession.databaseAdapter
     val sw = new StatementWriter(dba)
     sw.write("drop view " + entityTableName + " cascade")
--- a/src/main/scala/net/tz/lift/snippet/DataTable.scala	Sun Apr 01 23:25:17 2012 +0200
+++ b/src/main/scala/net/tz/lift/snippet/DataTable.scala	Mon Apr 02 00:06:52 2012 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011 Tomas Zeman <tzeman@volny.cz>
+ * Copyright 2011-2012 Tomas Zeman <tzeman@volny.cz>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
  */
 package net.tz.lift.snippet
 
-import net.liftweb.http.TemplateFinder
+import net.liftweb.http.Templates
 import net.liftweb.util.Helpers._ // CSS transforms
 import scala.xml.NodeSeq
 
@@ -24,7 +24,7 @@
  * Template location: <code>/templates-hidden/datatable</code>.
  */
 class DataTable(cols: List[String], cells: List[List[NodeSeq]]) extends CssTr {
-  def apply(in: NodeSeq): NodeSeq = TemplateFinder.findAnyTemplate(
+  def apply(in: NodeSeq): NodeSeq = Templates(
     List("templates-hidden", "datatable")) map { xml =>
     (".field-name *" #> cols &
     ".row *" #> cells.map { vals => "td *" #> vals })(xml)
--- a/src/main/scala/net/tz/lift/snippet/Loc.scala	Sun Apr 01 23:25:17 2012 +0200
+++ b/src/main/scala/net/tz/lift/snippet/Loc.scala	Mon Apr 02 00:06:52 2012 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011 Tomas Zeman <tzeman@volny.cz>
+ * Copyright 2011-2012 Tomas Zeman <tzeman@volny.cz>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -15,7 +15,7 @@
  */
 package net.tz.lift.snippet
 
-import net.liftweb.http.TemplateFinder
+import net.liftweb.http.Templates
 import net.liftweb.sitemap.Loc._
 import scala.xml.NodeSeq
 
@@ -26,10 +26,10 @@
 object LocTpl {
 
   def apply(path: String): Template = Template(() =>
-    TemplateFinder.findAnyTemplate(path split "/" toList) openOr NodeSeq.Empty)
+    Templates(path split "/" toList) openOr NodeSeq.Empty)
 
   def apply[T](f: T => String): ValueTemplate[T] = ValueTemplate[T](
-    _.flatMap { v => TemplateFinder.findAnyTemplate(f(v) split "/" toList)
+    _.flatMap { v => Templates(f(v) split "/" toList)
     } openOr NodeSeq.Empty)
 }
 
--- a/src/main/scala/net/tz/lift/snippet/Panel.scala	Sun Apr 01 23:25:17 2012 +0200
+++ b/src/main/scala/net/tz/lift/snippet/Panel.scala	Mon Apr 02 00:06:52 2012 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011 Tomas Zeman <tzeman@volny.cz>
+ * Copyright 2011-2012 Tomas Zeman <tzeman@volny.cz>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -53,7 +53,7 @@
   }
 }
 
-import net.liftweb.http.TemplateFinder
+import net.liftweb.http.Templates
 import net.liftweb.util.Helpers._ // CSS transforms
 
 /**
@@ -61,7 +61,7 @@
  * values rendering.
  */
 class TplPanel(cells: List[(NodeSeq, NodeSeq)]) extends CssTr {
-  def apply(in: NodeSeq): NodeSeq = TemplateFinder.findAnyTemplate(
+  def apply(in: NodeSeq): NodeSeq = Templates(
     List("templates-hidden", "panel")) map { xml =>
     (".row *" #> cells.map { r =>
       ".n *" #> r._1 &
--- a/src/test/scala/fis/base/model/SeqIdPostgreSqlAdapterSpec.scala	Sun Apr 01 23:25:17 2012 +0200
+++ b/src/test/scala/fis/base/model/SeqIdPostgreSqlAdapterSpec.scala	Mon Apr 02 00:06:52 2012 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright 2011 Tomas Zeman <tzeman@volny.cz>
+ * Copyright 2011-2012 Tomas Zeman <tzeman@volny.cz>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
 import org.scalatest.matchers.ShouldMatchers
 
 class SeqIdPostgreSqlAdapterSpec extends FlatSpec with ShouldMatchers
-  with Logger with BeforeAndAfterAllFunctions {
+  with Logger with BeforeAndAfterAll {
 
   import java.sql.Connection
   import net.liftweb.mapper.DB
@@ -39,11 +39,11 @@
   DB.defineConnectionManager(PgsqlConnectionIdentifier, dbVendor)
   SquerylRecord.init(() => new SeqIdPostgreSqlAdapter)
 
-  beforeAll {
+  override def beforeAll {
     //doInDB { dropAndCreate }
   }
 
-  afterAll {
+  override def afterAll {
     dbVendor.closeAllConnections_!
   }