Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 82f05f8
Showing
23 changed files
with
750 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# use glob syntax. | ||
syntax: glob | ||
*.ser | ||
*.class | ||
*~ | ||
*.bak | ||
*.off | ||
*.old | ||
.DS_Store | ||
|
||
# logs | ||
derby.log | ||
|
||
# eclipse conf file | ||
.settings | ||
.classpath | ||
.project | ||
.manager | ||
|
||
# building | ||
target | ||
build | ||
null | ||
tmp* | ||
dist | ||
test-output | ||
|
||
# sbt | ||
target | ||
lib_managed | ||
src_managed | ||
project/boot | ||
|
||
# db | ||
lift_proto* | ||
|
||
# other scm | ||
.svn | ||
.CVS | ||
.hg* | ||
|
||
# switch to regexp syntax. | ||
# syntax: regexp | ||
# ^\.pc/ | ||
|
||
# IntelliJ | ||
*.iml | ||
*.ipr | ||
*.iws | ||
.idea | ||
|
||
# Pax Runner (for easy OSGi launching) | ||
runner | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
|
||
|
||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>code</groupId> | ||
<artifactId>app</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
<packaging>war</packaging> | ||
<name>app Project</name> | ||
<inceptionYear>2010</inceptionYear> | ||
<properties> | ||
<scala.version>2.7.7</scala.version> | ||
</properties> | ||
|
||
<repositories> | ||
<repository> | ||
<id>scala-tools.releases</id> | ||
<name>Scala-Tools Dependencies Repository for Releases</name> | ||
<url>http://scala-tools.org/repo-releases</url> | ||
</repository> | ||
<repository> | ||
<id>scala-tools.snapshots</id> | ||
<name>Scala-Tools Dependencies Repository for Snapshots</name> | ||
<url>http://scala-tools.org/repo-snapshots</url> | ||
<snapshots/> | ||
</repository> | ||
</repositories> | ||
|
||
<pluginRepositories> | ||
<pluginRepository> | ||
<id>scala-tools.org.releases</id> | ||
<name>Scala-Tools Plugins Repository for Releases</name> | ||
<url>http://scala-tools.org/repo-releases</url> | ||
</pluginRepository> | ||
</pluginRepositories> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>net.liftweb</groupId> | ||
<artifactId>lift-mapper</artifactId> | ||
<version>2.0-SNAPSHOT</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.h2database</groupId> | ||
<artifactId>h2</artifactId> | ||
<version>1.2.121</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>servlet-api</artifactId> | ||
<version>2.5</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<version>4.5</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.scala-tools.testing</groupId> | ||
<artifactId>specs</artifactId> | ||
<version>1.6.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mortbay.jetty</groupId> | ||
<artifactId>jetty</artifactId> | ||
<version>[6.1.6,7.0)</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<!-- for LiftConsole --> | ||
<dependency> | ||
<groupId>org.scala-lang</groupId> | ||
<artifactId>scala-compiler</artifactId> | ||
<version>${scala.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<sourceDirectory>src/main/scala</sourceDirectory> | ||
<testSourceDirectory>src/test/scala</testSourceDirectory> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.scala-tools</groupId> | ||
<artifactId>maven-scala-plugin</artifactId> | ||
<version>2.13.1</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>compile</goal> | ||
<goal>testCompile</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.mortbay.jetty</groupId> | ||
<artifactId>maven-jetty-plugin</artifactId> | ||
<version>6.1.22</version> | ||
<configuration> | ||
<contextPath>/</contextPath> | ||
<scanIntervalSeconds>5</scanIntervalSeconds> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>net.sf.alchim</groupId> | ||
<artifactId>yuicompressor-maven-plugin</artifactId> | ||
<version>0.7.1</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>compress</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<nosuffix>true</nosuffix> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-idea-plugin</artifactId> | ||
<version>2.2</version> | ||
<configuration> | ||
<downloadSources>true</downloadSources> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-eclipse-plugin</artifactId> | ||
<version>2.7</version> | ||
<configuration> | ||
<downloadSources>true</downloadSources> | ||
<additionalProjectnatures> | ||
<projectnature>ch.epfl.lamp.sdt.core.scalanature</projectnature> | ||
</additionalProjectnatures> | ||
<additionalBuildcommands> | ||
<buildcommand>ch.epfl.lamp.sdt.core.scalabuilder</buildcommand> | ||
</additionalBuildcommands> | ||
<classpathContainers> | ||
<classpathContainer>ch.epfl.lamp.sdt.launching.SCALA_CONTAINER</classpathContainer> | ||
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer> | ||
</classpathContainers> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<reporting> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.scala-tools</groupId> | ||
<artifactId>maven-scala-plugin</artifactId> | ||
<version>2.13.1</version> | ||
</plugin> | ||
</plugins> | ||
</reporting> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#Project properties | ||
#Fri Apr 23 11:24:20 PDT 2010 | ||
project.organization=Lift | ||
project.name=Lift SBT Tempalte | ||
sbt.version=0.7.2 | ||
project.version=0.1 | ||
def.scala.version=2.7.7 | ||
build.scala.versions=2.7.7 | ||
project.initialize=false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import sbt._ | ||
|
||
class LiftProject(info: ProjectInfo) extends DefaultWebProject(info) { | ||
val mavenLocal = "Local Maven Repository" at | ||
"file://"+Path.userHome+"/.m2/repository" | ||
|
||
val scalatools_snapshot = "Scala Tools Snapshot" at | ||
"http://scala-tools.org/repo-snapshots/" | ||
|
||
val scalatools_release = "Scala Tools Snapshot" at | ||
"http://scala-tools.org/repo-releases/" | ||
|
||
val liftVersion = "2.0-SNAPSHOT" | ||
|
||
override def libraryDependencies = Set( | ||
"net.liftweb" % "lift-webkit" % liftVersion % "compile->default", | ||
"net.liftweb" % "lift-mapper" % liftVersion % "compile->default", | ||
"net.liftweb" % "lift-testkit" % liftVersion % "compile->default", | ||
"net.liftweb" % "lift-wizard" % liftVersion % "compile->default", | ||
"org.mortbay.jetty" % "jetty" % "6.1.22" % "test->default", | ||
"com.h2database" % "h2" % "1.2.121" | ||
) ++ super.libraryDependencies | ||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package bootstrap.liftweb | ||
|
||
import _root_.net.liftweb.util._ | ||
import _root_.net.liftweb.common._ | ||
import _root_.net.liftweb.http._ | ||
import _root_.net.liftweb.http.provider._ | ||
import _root_.net.liftweb.sitemap._ | ||
import _root_.net.liftweb.sitemap.Loc._ | ||
import Helpers._ | ||
import _root_.net.liftweb.mapper.{DB, ConnectionManager, Schemifier, DefaultConnectionIdentifier, StandardDBVendor} | ||
import _root_.java.sql.{Connection, DriverManager} | ||
import _root_.code.model._ | ||
|
||
|
||
/** | ||
* A class that's instantiated early and run. It allows the application | ||
* to modify lift's environment | ||
*/ | ||
class Boot { | ||
def boot { | ||
if (!DB.jndiJdbcConnAvailable_?) { | ||
val vendor = | ||
new StandardDBVendor(Props.get("db.driver") openOr "org.h2.Driver", | ||
Props.get("db.url") openOr | ||
"jdbc:h2:lift_proto.db;AUTO_SERVER=TRUE", | ||
Props.get("db.user"), Props.get("db.password")) | ||
|
||
LiftRules.unloadHooks.append(vendor.closeAllConnections_! _) | ||
|
||
DB.defineConnectionManager(DefaultConnectionIdentifier, vendor) | ||
} | ||
|
||
// where to search snippet | ||
LiftRules.addToPackages("code") | ||
Schemifier.schemify(true, Schemifier.infoF _, User) | ||
|
||
// Build SiteMap | ||
val entries = Menu(Loc("Home", List("index"), "Home")) :: | ||
Menu(Loc("Static", Link(List("static"), true, "/static/index"), | ||
"Static Content")) :: | ||
User.sitemap | ||
|
||
LiftRules.setSiteMap(SiteMap(entries:_*)) | ||
|
||
/* | ||
* Show the spinny image when an Ajax call starts | ||
*/ | ||
LiftRules.ajaxStart = | ||
Full(() => LiftRules.jsArtifacts.show("ajax-loader").cmd) | ||
|
||
/* | ||
* Make the spinny image go away when it ends | ||
*/ | ||
LiftRules.ajaxEnd = | ||
Full(() => LiftRules.jsArtifacts.hide("ajax-loader").cmd) | ||
|
||
LiftRules.early.append(makeUtf8) | ||
|
||
LiftRules.loggedInTest = Full(() => User.loggedIn_?) | ||
|
||
S.addAround(DB.buildLoanWrapper) | ||
} | ||
|
||
/** | ||
* Force the request to be UTF-8 | ||
*/ | ||
private def makeUtf8(req: HTTPRequest) { | ||
req.setCharacterEncoding("UTF-8") | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package code { | ||
package lib { | ||
|
||
import net.liftweb._ | ||
import http._ | ||
import util._ | ||
import common._ | ||
import _root_.java.util.Date | ||
|
||
/** | ||
* A factory for generating new instances of Date. You can create | ||
* factories for each kind of thing you want to vend in your application. | ||
* An example is a payment gateway. You can change the default implementation, | ||
* or override the default implementation on a session, request or current call | ||
* stack basis. | ||
*/ | ||
object DependencyFactory extends Factory { | ||
implicit object time extends FactoryMaker(Helpers.now _) | ||
|
||
/** | ||
* objects in Scala are lazily created. The init() | ||
* method creates a List of all the objects. This | ||
* results in all the objects getting initialized and | ||
* registering their types with the dependency injector | ||
*/ | ||
private def init() { | ||
List(time) | ||
} | ||
init() | ||
} | ||
|
||
/* | ||
/** | ||
* Examples of changing the implementation | ||
*/ | ||
sealed abstract class Changer { | ||
def changeDefaultImplementation() { | ||
DependencyFactory.time.default.set(() => new Date()) | ||
} | ||
def changeSessionImplementation() { | ||
DependencyFactory.time.session.set(() => new Date()) | ||
} | ||
def changeRequestImplementation() { | ||
DependencyFactory.time.request.set(() => new Date()) | ||
} | ||
def changeJustForCall(d: Date) { | ||
DependencyFactory.time.doWith(d) { | ||
// perform some calculations here | ||
} | ||
} | ||
} | ||
*/ | ||
} | ||
} |
Oops, something went wrong.