Skip to content

Commit

Permalink
Make SystemEnv constructor private
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed May 10, 2012
1 parent 01f1a48 commit dee6347
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/Global.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ object Global extends GlobalSettings {
def env = Option(systemEnv) err "The environment is not ready"

override def onStart(app: Application) {
val settings = new Settings(app.configuration.underlying)
systemEnv = new SystemEnv(app, settings)

systemEnv = SystemEnv(app)

if (env.isAiServer) println("Running as AI server")
else Cron start env
Expand Down
10 changes: 9 additions & 1 deletion app/SystemEnv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import db._
import ai._
import memo._

final class SystemEnv(application: Application, settings: Settings) {
final class SystemEnv private (application: Application, settings: Settings) {

implicit val app = application

Expand Down Expand Up @@ -186,3 +186,11 @@ final class SystemEnv(application: Application, settings: Settings) {

lazy val gameCleanNextCommand = new command.GameCleanNext(gameRepo = gameRepo)
}

object SystemEnv {

def apply(app: Application) = new SystemEnv(
app,
new Settings(app.configuration.underlying)
)
}
2 changes: 1 addition & 1 deletion cli/src/main/scala/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ object Main {
sources = None,
mode = Mode.Dev)

lazy val env = new SystemEnv(app)
lazy val env = SystemEnv(app)

def main(args: Array[String]): Unit = sys exit {

Expand Down

0 comments on commit dee6347

Please sign in to comment.