Browse Source

initial commit

master
jimi 11 years ago
commit
be4874442a
  1. 15
      .gitignore
  2. 4
      README
  3. 12
      app/controllers/Application.scala
  4. 7
      app/views/index.scala.html
  5. 15
      app/views/main.scala.html
  6. 11
      build.sbt
  7. 59
      conf/application.conf
  8. 9
      conf/routes
  9. 1
      project/build.properties
  10. 8
      project/plugins.sbt
  11. BIN
      public/images/favicon.png
  12. 4
      public/javascripts/jquery-1.9.0.min.js
  13. 0
      public/stylesheets/main.css
  14. 30
      test/ApplicationSpec.scala
  15. 24
      test/IntegrationSpec.scala

15
.gitignore

@ -0,0 +1,15 @@
logs
project/project
project/target
target
tmp
.history
dist
/.idea
/*.iml
/out
/.idea_modules
/.classpath
/.project
/RUNNING_PID
/.settings

4
README

@ -0,0 +1,4 @@
This is your new Play application
=====================================
This file will be packaged with your application, when using `play dist`.

12
app/controllers/Application.scala

@ -0,0 +1,12 @@
package controllers
import play.api._
import play.api.mvc._
object Application extends Controller {
def index = Action {
Ok(views.html.index("Your new application is ready."))
}
}

7
app/views/index.scala.html

@ -0,0 +1,7 @@
@(message: String)
@main("Welcome to Play") {
@play20.welcome(message)
}

15
app/views/main.scala.html

@ -0,0 +1,15 @@
@(title: String)(content: Html)
<!DOCTYPE html>
<html>
<head>
<title>@title</title>
<link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")">
<link rel="shortcut icon" type="image/png" href="@routes.Assets.at("images/favicon.png")">
<script src="@routes.Assets.at("javascripts/jquery-1.9.0.min.js")" type="text/javascript"></script>
</head>
<body>
@content
</body>
</html>

11
build.sbt

@ -0,0 +1,11 @@
name := "todolist"
version := "1.0-SNAPSHOT"
libraryDependencies ++= Seq(
jdbc,
anorm,
cache
)
play.Project.playScalaSettings

59
conf/application.conf

@ -0,0 +1,59 @@
# This is the main configuration file for the application.
# ~~~~~
# Secret key
# ~~~~~
# The secret key is used to secure cryptographics functions.
# If you deploy your application to several instances be sure to use the same key!
application.secret="IHmuUsffeQAPhy20]fYAUPKJ/lX:ZgYc3tMdD6xtAWfL3xpuYPYRvpqe]ufoixee"
# The application languages
# ~~~~~
application.langs="en"
# Global object class
# ~~~~~
# Define the Global object class for this application.
# Default to Global in the root package.
# application.global=Global
# Router
# ~~~~~
# Define the Router object to use for this application.
# This router will be looked up first when the application is starting up,
# so make sure this is the entry point.
# Furthermore, it's assumed your route file is named properly.
# So for an application router like `my.application.Router`,
# you may need to define a router file `conf/my.application.routes`.
# Default to Routes in the root package (and conf/routes)
# application.router=my.application.Routes
# Database configuration
# ~~~~~
# You can declare as many datasources as you want.
# By convention, the default datasource is named `default`
#
# db.default.driver=org.h2.Driver
# db.default.url="jdbc:h2:mem:play"
# db.default.user=sa
# db.default.password=""
# Evolutions
# ~~~~~
# You can disable evolutions if needed
# evolutionplugin=disabled
# Logger
# ~~~~~
# You can also configure logback (http://logback.qos.ch/),
# by providing an application-logger.xml file in the conf directory.
# Root logger:
logger.root=ERROR
# Logger used by the framework:
logger.play=INFO
# Logger provided to your application:
logger.application=DEBUG

9
conf/routes

@ -0,0 +1,9 @@
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Home page
GET / controllers.Application.index
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)

1
project/build.properties

@ -0,0 +1 @@
sbt.version=0.13.0

8
project/plugins.sbt

@ -0,0 +1,8 @@
// Comment to get more information during initialization
logLevel := Level.Warn
// The Typesafe repository
resolvers += "Typesafe repository" at "http://repo.typesafe.com/typesafe/releases/"
// Use the Play sbt plugin for Play projects
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.0")

BIN
public/images/favicon.png

After

Width: 16  |  Height: 16  |  Size: 687 B

4
public/javascripts/jquery-1.9.0.min.js
File diff suppressed because it is too large
View File

0
public/stylesheets/main.css

30
test/ApplicationSpec.scala

@ -0,0 +1,30 @@
import org.specs2.mutable._
import org.specs2.runner._
import org.junit.runner._
import play.api.test._
import play.api.test.Helpers._
/**
* Add your spec here.
* You can mock out a whole application including requests, plugins etc.
* For more information, consult the wiki.
*/
@RunWith(classOf[JUnitRunner])
class ApplicationSpec extends Specification {
"Application" should {
"send 404 on a bad request" in new WithApplication{
route(FakeRequest(GET, "/boum")) must beNone
}
"render the index page" in new WithApplication{
val home = route(FakeRequest(GET, "/")).get
status(home) must equalTo(OK)
contentType(home) must beSome.which(_ == "text/html")
contentAsString(home) must contain ("Your new application is ready.")
}
}
}

24
test/IntegrationSpec.scala

@ -0,0 +1,24 @@
import org.specs2.mutable._
import org.specs2.runner._
import org.junit.runner._
import play.api.test._
import play.api.test.Helpers._
/**
* add your integration spec here.
* An integration test will fire up a whole play application in a real (or headless) browser
*/
@RunWith(classOf[JUnitRunner])
class IntegrationSpec extends Specification {
"Application" should {
"work from within a browser" in new WithBrowser {
browser.goTo("http://localhost:" + port)
browser.pageSource must contain("Your new application is ready.")
}
}
}