First commit with minimalized play2 installation
commit
d6f27cafa4
|
@ -0,0 +1,5 @@
|
||||||
|
logs
|
||||||
|
project/project
|
||||||
|
project/target
|
||||||
|
target
|
||||||
|
tmp
|
|
@ -0,0 +1,9 @@
|
||||||
|
lichess.org in scala
|
||||||
|
=====================================
|
||||||
|
|
||||||
|
Long way to go.
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
[http://lichess.org](http://lichess.org)
|
|
@ -0,0 +1,59 @@
|
||||||
|
//import util.control.Exception.allCatch
|
||||||
|
//import scalaz.{ Validation ⇒ SValidation, Success, Failure, Semigroup, Apply }
|
||||||
|
|
||||||
|
//trait Validation
|
||||||
|
//extends scalaz.Validations
|
||||||
|
//with scalaz.Semigroups
|
||||||
|
//with scalaz.Options
|
||||||
|
//with scalaz.Identitys {
|
||||||
|
|
||||||
|
//type Valid[A] = SValidation[Error, A]
|
||||||
|
|
||||||
|
//implicit def eitherToValidation[E, B](either: Either[E, B]): Valid[B] =
|
||||||
|
//validation(either.left map {
|
||||||
|
//case e: Error => e
|
||||||
|
//case e: Throwable => Error(e)
|
||||||
|
//case s: String => Error(s wrapNel)
|
||||||
|
//})
|
||||||
|
|
||||||
|
//implicit def stringToError(str: String): Error = Error(str wrapNel)
|
||||||
|
|
||||||
|
//implicit def richStringToError(str: String) = new {
|
||||||
|
//def toError: Error = stringToError(str)
|
||||||
|
//}
|
||||||
|
|
||||||
|
//implicit def errorSemigroup: Semigroup[Error] = semigroup(_ |+| _)
|
||||||
|
|
||||||
|
//implicit def richValidation[A](validation: Valid[A]) = new {
|
||||||
|
//def and[B](f: Valid[A => B])(implicit a: Apply[Valid]): Valid[B] = validation <*> f
|
||||||
|
//}
|
||||||
|
|
||||||
|
//def unsafe[A](op: ⇒ A)(implicit handle: Throwable => Error = Error.apply): Valid[A] =
|
||||||
|
//(allCatch either op).left map handle
|
||||||
|
|
||||||
|
//def validateOption[A, B](ao: Option[A])(op: A => Valid[B]): Valid[Option[B]] =
|
||||||
|
//ao some { a ⇒ op(a) map (_.some) } none success(none)
|
||||||
|
|
||||||
|
//def sequenceValid[A](as: List[Valid[A]]): Valid[List[A]] =
|
||||||
|
//as.sequence[({ type λ[α] = Valid[α] })#λ, A]
|
||||||
|
//}
|
||||||
|
|
||||||
|
//import scalaz.NonEmptyList
|
||||||
|
|
||||||
|
//case class Error(messages: NonEmptyList[String]) {
|
||||||
|
|
||||||
|
//def |+|(error: Error): Error = Error(messages |+| error.messages)
|
||||||
|
|
||||||
|
//def messageList = messages.list
|
||||||
|
|
||||||
|
//def size = messageList.size
|
||||||
|
|
||||||
|
//override def toString = messageList map ("* " + _) mkString "\n"
|
||||||
|
//}
|
||||||
|
|
||||||
|
//object Error {
|
||||||
|
|
||||||
|
//def apply(t: Throwable): Error = string(t.getMessage)
|
||||||
|
|
||||||
|
//def string(str: String): Error = Error(str wrapNel)
|
||||||
|
//}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package controllers
|
||||||
|
|
||||||
|
import play.api._
|
||||||
|
import play.api.mvc._
|
||||||
|
|
||||||
|
object Application extends Controller {
|
||||||
|
|
||||||
|
def index = Action {
|
||||||
|
Ok("Your new application is ready.")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
log4j.rootLogger=info, R
|
||||||
|
log4j.appender.R=org.apache.log4j.ConsoleAppender
|
||||||
|
log4j.appender.R.layout=org.apache.log4j.PatternLayout
|
||||||
|
log4j.appender.R.layout.ConversionPattern=%-5p %-30.30c{1} %x - %m%n
|
|
@ -0,0 +1,50 @@
|
||||||
|
# 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="a@23iWMuTu?v=^HqWBe4>Th^RqCRATWI=mPAkdY`_I`m>ovpLi1KKR;CLv`Iny4B"
|
||||||
|
|
||||||
|
# The application languages
|
||||||
|
# ~~~~~
|
||||||
|
application.langs="en"
|
||||||
|
|
||||||
|
# Global object class
|
||||||
|
# ~~~~~
|
||||||
|
# Define the Global object class for this application.
|
||||||
|
# Default to Global in the root package.
|
||||||
|
# global=Global
|
||||||
|
|
||||||
|
# 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=
|
||||||
|
|
||||||
|
mongo.host = localhost
|
||||||
|
mongo.dbname = lichess
|
||||||
|
|
||||||
|
# Evolutions
|
||||||
|
# ~~~~~
|
||||||
|
# You can disable evolutions if needed
|
||||||
|
# evolutionplugin=disabled
|
||||||
|
|
||||||
|
# Logger
|
||||||
|
# ~~~~~
|
||||||
|
# You can also configure logback (http://logback.qos.ch/), by providing a 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
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
GET / controllers.Application.index
|
|
@ -0,0 +1,26 @@
|
||||||
|
package object lila
|
||||||
|
//extends Validation
|
||||||
|
//with DateTime
|
||||||
|
extends scalaz.Identitys
|
||||||
|
with scalaz.Equals
|
||||||
|
with scalaz.MABs
|
||||||
|
with scalaz.Options
|
||||||
|
with scalaz.Lists
|
||||||
|
with scalaz.Booleans
|
||||||
|
with scalaz.Strings
|
||||||
|
with scalaz.NonEmptyLists
|
||||||
|
with scalaz.Semigroups {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* K combinator implementation
|
||||||
|
* Provides oneliner side effects
|
||||||
|
* See http://hacking-scala.posterous.com/side-effecting-without-braces
|
||||||
|
*/
|
||||||
|
implicit def addKcombinator[A](any: A) = new {
|
||||||
|
def kCombinator(sideEffect: A => Unit): A = {
|
||||||
|
sideEffect(any)
|
||||||
|
any
|
||||||
|
}
|
||||||
|
def ~(sideEffect: A => Unit): A = kCombinator(sideEffect)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
import sbt._
|
||||||
|
import Keys._
|
||||||
|
import PlayProject._
|
||||||
|
|
||||||
|
trait Resolvers {
|
||||||
|
val codahale = "repo.codahale.com" at "http://repo.codahale.com/"
|
||||||
|
//val twitter = "twitter.com" at "http://maven.twttr.com/"
|
||||||
|
val typesafe = "typesafe.com" at "http://repo.typesafe.com/typesafe/releases/"
|
||||||
|
val iliaz = "iliaz.com" at "http://scala.iliaz.com/"
|
||||||
|
val sonatype = "sonatype" at "http://oss.sonatype.org/content/repositories/releases"
|
||||||
|
}
|
||||||
|
|
||||||
|
trait Dependencies {
|
||||||
|
val twitterUtilVersion = "1.12.12"
|
||||||
|
|
||||||
|
val twitterCore = "com.twitter" % "util-core" % twitterUtilVersion
|
||||||
|
val slf4jNop = "org.slf4j" % "slf4j-nop" % "1.6.4"
|
||||||
|
val scalaz = "org.scalaz" %% "scalaz-core" % "6.0.4"
|
||||||
|
val specs2 = "org.specs2" %% "specs2" % "1.8"
|
||||||
|
val redis = "net.debasishg" %% "redisclient" % "2.4.2"
|
||||||
|
val json = "net.liftweb" %% "lift-json" % "2.4-RC1"
|
||||||
|
val casbah = "com.mongodb.casbah" %% "casbah" % "2.1.5-1"
|
||||||
|
val salat = "com.novus" %% "salat-core" % "0.0.8-SNAPSHOT"
|
||||||
|
}
|
||||||
|
|
||||||
|
object ApplicationBuild extends Build with Resolvers with Dependencies {
|
||||||
|
|
||||||
|
val appName = "lila"
|
||||||
|
val appVersion = "1.0-SNAPSHOT"
|
||||||
|
|
||||||
|
val main = PlayProject(appName, appVersion, Seq(
|
||||||
|
scalaz, specs2, redis, json, slf4jNop
|
||||||
|
), mainLang = SCALA).settings(
|
||||||
|
resolvers := Seq(
|
||||||
|
codahale, typesafe, iliaz, sonatype
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
sbt.version=0.11.2
|
|
@ -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("play" % "sbt-plugin" % "2.0-RC3-SNAPSHOT")
|
Loading…
Reference in New Issue