Skip to content
This repository has been archived by the owner on Aug 12, 2019. It is now read-only.

Commit

Permalink
* Worked on lift_blank
Browse files Browse the repository at this point in the history
* Added logback-test.xml file (which has a different name schema than the default xml file).
* Updated specs tests to use specs2
  • Loading branch information
fmpwizard committed Jul 7, 2012
1 parent 9a1822e commit f57f5ca
Show file tree
Hide file tree
Showing 17 changed files with 221 additions and 165 deletions.
4 changes: 2 additions & 2 deletions scala_29/lift_basic/project/plugins.sbt
Expand Up @@ -6,7 +6,7 @@ libraryDependencies <+= sbtVersion(v => v match {
}) })


//Uncoment this line to enable the sbt idea plugin //Uncoment this line to enable the sbt idea plugin
//addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.0.0") addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.0.0")


//Uncoment this line to enable the sbt eclipse plugin //Uncoment this line to enable the sbt eclipse plugin
//addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0-RC1") addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0-RC1")
23 changes: 23 additions & 0 deletions scala_29/lift_basic/src/test/resources/logback-test.xml
@@ -0,0 +1,23 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>console.devmode.log</file>
<append>true</append>
<encoder>
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
</appender>



<logger name="code.snippet" level="info" />
<logger name="net.liftweb" level="warn" />
<logger name="bootstrap.liftweb" level="info" />
<root level="warn">
<appender-ref ref="STDOUT" />
</root>
</configuration>
@@ -1,28 +1,29 @@
package code package code
package snippet package snippet


import org.specs._
import net.liftweb._ import net.liftweb._
import http._ import http._
import net.liftweb.util._ import net.liftweb.util._
import net.liftweb.common._ import net.liftweb.common._
import org.specs.specification._
import Helpers._ import Helpers._
import lib._ import lib._
import org.specs2.mutable.Specification
import org.specs2.specification.AroundExample
import org.specs2.execute.Result




object HelloWorldTestSpecs extends Specification { object HelloWorldTestSpecs extends Specification with AroundExample{
val session = new LiftSession("", randomString(20), Empty) val session = new LiftSession("", randomString(20), Empty)
val stableTime = now val stableTime = now


/** /**
* For additional ways of writing tests, * For additional ways of writing tests,
* please see http://www.assembla.com/spaces/liftweb/wiki/Mocking_HTTP_Requests * please see http://www.assembla.com/spaces/liftweb/wiki/Mocking_HTTP_Requests
*/ */
override def executeExpectations(ex: Examples, t: =>Any): Any = { def around[T <% Result](body: => T) = {
S.initIfUninitted(session) { S.initIfUninitted(session) {
DependencyFactory.time.doWith(stableTime) { DependencyFactory.time.doWith(stableTime) {
super.executeExpectations(ex, t) body
} }
} }
} }
Expand Down
27 changes: 27 additions & 0 deletions scala_29/lift_blank/build.sbt
@@ -0,0 +1,27 @@
name := "Lift 2.5 starter template"

version := "0.0.1"

organization := "net.liftweb"

scalaVersion := "2.9.1"

resolvers ++= Seq("snapshots" at "http://oss.sonatype.org/content/repositories/snapshots",
"releases" at "http://oss.sonatype.org/content/repositories/releases"
)

seq(com.github.siasia.WebPlugin.webSettings :_*)

scalacOptions ++= Seq("-deprecation", "-unchecked")

libraryDependencies ++= {
val liftVersion = "2.5-SNAPSHOT"
Seq(
"net.liftweb" %% "lift-webkit" % liftVersion % "compile",
"net.liftmodules" %% "lift-jquery-module" % (liftVersion + "-1.0-SNAPSHOT"),
"org.eclipse.jetty" % "jetty-webapp" % "7.5.4.v20111024" % "container; test",
"ch.qos.logback" % "logback-classic" % "1.0.6",
"org.specs2" %% "specs2" % "1.11" % "test"
)
}

9 changes: 0 additions & 9 deletions scala_29/lift_blank/project/build.properties

This file was deleted.

24 changes: 0 additions & 24 deletions scala_29/lift_blank/project/build/LiftProject.scala

This file was deleted.

12 changes: 12 additions & 0 deletions scala_29/lift_blank/project/plugins.sbt
@@ -0,0 +1,12 @@
libraryDependencies <+= sbtVersion(v => v match {
case "0.11.0" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.0-0.2.8"
case "0.11.1" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.1-0.2.10"
case "0.11.2" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.2-0.2.11"
case "0.11.3" => "com.github.siasia" %% "xsbt-web-plugin" % "0.11.3-0.2.11.1"
})

//Uncoment this line to enable the sbt idea plugin
addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.0.0")

//Uncoment this line to enable the sbt eclipse plugin
//addSbtPlugin("com.typesafe.sbteclipse" % "sbteclipse-plugin" % "2.1.0-RC1")
2 changes: 1 addition & 1 deletion scala_29/lift_blank/sbt
@@ -1 +1 @@
java -Xmx1024M -Xss2M -XX:+CMSClassUnloadingEnabled -jar `dirname $0`/sbt-launcher.jar "$@" java -Xmx1024M -Xss2M -XX:MaxPermSize=512m -XX:+CMSClassUnloadingEnabled -jar `dirname $0`/sbt-launcher.jar "$@"
Binary file modified scala_29/lift_blank/sbt-launcher.jar
Binary file not shown.
23 changes: 23 additions & 0 deletions scala_29/lift_blank/src/main/resources/props/default.logback.xml
@@ -0,0 +1,23 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>console.devmode.log</file>
<append>true</append>
<encoder>
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
</appender>



<logger name="code.snippet" level="info" />
<logger name="net.liftweb" level="warn" />
<logger name="bootstrap.liftweb" level="info" />
<root level="warn">
<appender-ref ref="STDOUT" />
</root>
</configuration>
14 changes: 11 additions & 3 deletions scala_29/lift_blank/src/main/scala/bootstrap/liftweb/Boot.scala
Expand Up @@ -8,6 +8,8 @@ import common._
import http._ import http._
import sitemap._ import sitemap._
import Loc._ import Loc._
import net.liftmodules.JQueryModule
import net.liftweb.http.js.jquery._




/** /**
Expand All @@ -32,9 +34,6 @@ class Boot {
// each page, just comment this line out. // each page, just comment this line out.
LiftRules.setSiteMap(SiteMap(entries:_*)) LiftRules.setSiteMap(SiteMap(entries:_*))


// Use jQuery 1.4
LiftRules.jsArtifacts = net.liftweb.http.js.jquery.JQuery14Artifacts

//Show the spinny image when an Ajax call starts //Show the spinny image when an Ajax call starts
LiftRules.ajaxStart = LiftRules.ajaxStart =
Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd) Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd)
Expand All @@ -46,5 +45,14 @@ class Boot {
// Force the request to be UTF-8 // Force the request to be UTF-8
LiftRules.early.append(_.setCharacterEncoding("UTF-8")) LiftRules.early.append(_.setCharacterEncoding("UTF-8"))


// Use HTML5 for rendering
LiftRules.htmlProperties.default.set((r: Req) =>
new Html5Properties(r.userAgent))

//Init the jQuery module, see http://liftweb.net/jquery for more information.
LiftRules.jsArtifacts = JQueryArtifacts
JQueryModule.InitParam.JQuery=JQueryModule.JQuery172
JQueryModule.init()

} }
} }
85 changes: 74 additions & 11 deletions scala_29/lift_blank/src/main/webapp/templates-hidden/default.html
Expand Up @@ -3,20 +3,83 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="description" content="" /> <meta name="description" content="" />
<meta name="keywords" content="" /> <meta name="keywords" content="" />
<title><span class="lift:Menu.title">code:app:0.1-SNAPSHOT</span></title> <title class="lift:Menu.title">App: </title>
<script id="jquery" src="/classpath/jquery.js" type="text/javascript"/> <style class="lift:CSS.blueprint"></style>
<style class="lift:CSS.fancyType"></style>
<script id="jquery" src="/classpath/jquery.js" type="text/javascript"></script>
<script id="json" src="/classpath/json.js" type="text/javascript"></script>
<style type="text/css">
/* <![CDATA[ */
.edit_error_class {
display: block;
color: red;
}

.sidebar ul {
margin:0;
padding:0;
border-bottom:1px solid #ccc;
}


.sidebar ul li {
margin:0;
padding:0;
list-style:none;
border:1px solid #ccc;
border-bottom:none;
}

.sidebar ul li a {
display:block;
padding:3px;
text-indent:30px;
text-decoration:none;
}

.sidebar ul li span {
display:block;
padding:3px;
text-indent:30px;
text-decoration:none;
}

.sidebar ul li a:hover {
background-color: #eee;
}


/* ]]> */
</style>
</head> </head>
<body> <body>
<div class="lift:Menu.builder"/> <div class="container">
<div class="lift:Msgs?showAll=true"/> <div class="column span-12 last" style="text-align: right">
<h1 class="alt">app<img alt="" id="ajax-loader" style="display:none; margin-bottom: 0px; margin-left: 5px" src="/images/ajax-loader.gif"></h1>
</div>

<hr>

<div class="column span-6 colborder sidebar">
<hr class="space" >

<span class="lift:Menu.builder"></span>

<div class="lift:Msgs?showAll=true"></div>
<hr class="space" />
</div>


<lift:bind name="content" /> <div class="column span-17 last">
<div id="content">The main content will get bound here</div>
</div>


<hr /> <hr />
<h4> <div class="column span-23 last" style="text-align: center">
<a href="http://www.liftweb.net"><i>Lift</i></a> <h4 class="alt">
is Copyright 2007-2011 WorldWide Conferencing, LLC. <a href="http://www.liftweb.net"><i>Lift</i></a>
Distributed under an Apache 2.0 License. is Copyright 2007-2012 WorldWide Conferencing, LLC.
</h4> Distributed under an Apache 2.0 License.</h4>
</div>
</div>
</body> </body>
</html> </html>
23 changes: 23 additions & 0 deletions scala_29/lift_blank/src/test/resources/logback-test.xml
@@ -0,0 +1,23 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.FileAppender">
<file>console.devmode.log</file>
<append>true</append>
<encoder>
<pattern>%-4relative [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
</appender>



<logger name="code.snippet" level="info" />
<logger name="net.liftweb" level="warn" />
<logger name="bootstrap.liftweb" level="info" />
<root level="warn">
<appender-ref ref="STDOUT" />
</root>
</configuration>
15 changes: 0 additions & 15 deletions scala_29/lift_blank/src/test/scala/LiftConsole.scala

This file was deleted.

15 changes: 8 additions & 7 deletions scala_29/lift_blank/src/test/scala/RunWebApp.scala
@@ -1,7 +1,7 @@
import org.mortbay.jetty.Connector import org.eclipse.jetty.server.handler.ContextHandler
import org.mortbay.jetty.Server import org.eclipse.jetty.server.nio.SelectChannelConnector
import org.mortbay.jetty.webapp.WebAppContext import org.eclipse.jetty.server.{Handler, Server}
import org.mortbay.jetty.nio._ import org.eclipse.jetty.webapp.WebAppContext


object RunWebApp extends App { object RunWebApp extends App {
val server = new Server val server = new Server
Expand All @@ -11,10 +11,11 @@ object RunWebApp extends App {


val context = new WebAppContext() val context = new WebAppContext()
context.setServer(server) context.setServer(server)
context.setContextPath("/")
context.setWar("src/main/webapp") context.setWar("src/main/webapp")


server.addHandler(context) val context0: ContextHandler = new ContextHandler();
context0.setHandler(context)
server.setHandler(context0)


try { try {
println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP") println(">>> STARTING EMBEDDED JETTY SERVER, PRESS ANY KEY TO STOP")
Expand All @@ -25,7 +26,7 @@ object RunWebApp extends App {
server.stop() server.stop()
server.join() server.join()
} catch { } catch {
case exc : Exception => { case exc: Exception => {
exc.printStackTrace() exc.printStackTrace()
System.exit(100) System.exit(100)
} }
Expand Down

0 comments on commit f57f5ca

Please sign in to comment.