forked from tjweir/LiftProject.g8
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
Tim Nelson
committed
Nov 4, 2011
1 parent
4e1dd6d
commit 4ad36e7
Showing
15 changed files
with
93 additions
and
46 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,16 @@ | ||
# Lift MongoDB Project | ||
|
||
[g8](http://github.com/n8han/giter8) template to get a Lift-MongoDB webapp up and running quickly. The template generates a project that uses [Twitter's Bootstrap](http://twitter.github.com/bootstrap/) and implements the [Mongoauth Lift Module](https://github.com/eltimn/lift-mongoauth). It uses SBT 0.11.0 as the build tool. It has not been tested with other versions of SBT. | ||
|
||
## Usage | ||
|
||
Install giter8 (g8) - [readme](http://github.com/n8han/giter8#readme) for more information. | ||
|
||
Install SBT 0.11.x - [Setup](https://github.com/harrah/xsbt/wiki/Setup) for more information. | ||
|
||
In a shell, run the following in the parent directory of the new project: | ||
|
||
g8 eltimn/lift-mongo | ||
cd <project-name> | ||
|
||
Please see the README file in your new project for further instructions on configuring and running your app. |
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 @@ | ||
seq(giter8Settings :_*) |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
addSbtPlugin("net.databinder" %% "giter8-plugin" % "0.3.0") |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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,48 @@ | ||
package $package$ | ||
|
||
import org.scalatest.{BeforeAndAfter, Spec} | ||
|
||
import net.liftweb._ | ||
import mongodb._ | ||
|
||
import com.mongodb.{Mongo, ServerAddress} | ||
|
||
/** | ||
* Creates a Mongo instance named after the class. | ||
* Therefore, each Spec class shares the same database. | ||
* Database is dropped after. | ||
*/ | ||
trait MongoTestKit extends BeforeAndAfter { | ||
this: Spec => | ||
|
||
def dbName = "test_"+this.getClass.getName | ||
.replace(".", "_") | ||
.toLowerCase | ||
|
||
def defaultServer = new ServerAddress("127.0.0.1", 27017) | ||
|
||
// If you need more than one db, override this | ||
def dbs: List[(MongoIdentifier, ServerAddress, String)] = List((DefaultMongoIdentifier, defaultServer, dbName)) | ||
|
||
def debug = false | ||
|
||
before { | ||
// define the dbs | ||
dbs foreach { case (id, srvr, name) => | ||
MongoDB.defineDb(id, new Mongo(srvr), name) | ||
} | ||
} | ||
|
||
after { | ||
if (!debug) { | ||
// drop the databases | ||
dbs foreach { case (id, _, _) => | ||
MongoDB.use(id) { db => db.dropDatabase } | ||
} | ||
} | ||
|
||
// clear the mongo instances | ||
MongoDB.close | ||
} | ||
} | ||
|
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