Skip to content

Instantly share code, notes, and snippets.

@sdb
Created October 13, 2010 15:32

Revisions

  1. sdb revised this gist Dec 12, 2010. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions Project.scala
    Original file line number Diff line number Diff line change
    @@ -23,7 +23,7 @@ class TestProject(info: ProjectInfo) extends DefaultProject(info) with Liquibase
    override lazy val liquibaseContexts = mode

    // define an environment for reading props from pwd.properties
    lazy val env = new BasicEnvironment
    lazy val liquibaseEnv = new BasicEnvironment
    {
    def log = TestProject.this.log
    def envBackingPath = "pwd.properties"
    @@ -32,6 +32,6 @@ class TestProject(info: ProjectInfo) extends DefaultProject(info) with Liquibase
    }

    // provide username and password as defined in pwd.properties
    override lazy val liquibaseUsername = env.username.get.getOrElse(null)
    override lazy val liquibasePassword = env.password.get.getOrElse(null)
    override lazy val liquibaseUsername = liquibaseEnv.username.get.getOrElse(null)
    override lazy val liquibasePassword = liquibaseEnv.password.get.getOrElse(null)
    }
  2. sdb revised this gist Oct 15, 2010. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions Project.scala
    Original file line number Diff line number Diff line change
    @@ -10,17 +10,17 @@ class TestProject(info: ProjectInfo) extends DefaultProject(info) with Liquibase
    lazy val mode = system[String]("mode").get.getOrElse(null)

    // provide the parameters for running liquibase commands
    lazy val changeLogFile = "config" / "db-changelog.xml"
    lazy val driver = "org.h2.Driver"
    lazy val liquibaseChangeLogFile = "config" / "db-changelog.xml"
    lazy val liquibaseDriver = "org.h2.Driver"

    // the URL depending on the mode
    lazy val url = mode match {
    lazy val liquibaseUrl = mode match {
    case "prd" => "jdbc:h2:tcp://dbserv:8084/~/sample"
    case _ => "jdbc:h2:file:sample"
    }

    // the contexts to run
    override lazy val contexts = mode
    override lazy val liquibaseContexts = mode

    // define an environment for reading props from pwd.properties
    lazy val env = new BasicEnvironment
    @@ -32,6 +32,6 @@ class TestProject(info: ProjectInfo) extends DefaultProject(info) with Liquibase
    }

    // provide username and password as defined in pwd.properties
    override lazy val username = env.username.get.getOrElse(null)
    override lazy val password = env.password.get.getOrElse(null)
    override lazy val liquibaseUsername = env.username.get.getOrElse(null)
    override lazy val liquibasePassword = env.password.get.getOrElse(null)
    }
  3. sdb revised this gist Oct 13, 2010. 1 changed file with 4 additions and 2 deletions.
    6 changes: 4 additions & 2 deletions Project.scala
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,7 @@
    import sbt._
    import com.github.sdb.sbt.liquibase._

    class TestProject(info: ProjectInfo) extends DefaultProject(info)
    with LiquiBasePlugin {
    class TestProject(info: ProjectInfo) extends DefaultProject(info) with LiquibasePlugin {

    // declare the required database driver as a runtime dependency
    val h2 = "com.h2database" % "h2" % "1.2.143" % "runtime"
    @@ -20,6 +19,9 @@ class TestProject(info: ProjectInfo) extends DefaultProject(info)
    case _ => "jdbc:h2:file:sample"
    }

    // the contexts to run
    override lazy val contexts = mode

    // define an environment for reading props from pwd.properties
    lazy val env = new BasicEnvironment
    {
  4. sdb created this gist Oct 13, 2010.
    35 changes: 35 additions & 0 deletions Project.scala
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    import sbt._
    import com.github.sdb.sbt.liquibase._

    class TestProject(info: ProjectInfo) extends DefaultProject(info)
    with LiquiBasePlugin {

    // declare the required database driver as a runtime dependency
    val h2 = "com.h2database" % "h2" % "1.2.143" % "runtime"

    // fetch the running mode from the system properties (dev, prd, ...)
    lazy val mode = system[String]("mode").get.getOrElse(null)

    // provide the parameters for running liquibase commands
    lazy val changeLogFile = "config" / "db-changelog.xml"
    lazy val driver = "org.h2.Driver"

    // the URL depending on the mode
    lazy val url = mode match {
    case "prd" => "jdbc:h2:tcp://dbserv:8084/~/sample"
    case _ => "jdbc:h2:file:sample"
    }

    // define an environment for reading props from pwd.properties
    lazy val env = new BasicEnvironment
    {
    def log = TestProject.this.log
    def envBackingPath = "pwd.properties"
    lazy val username = property[String]
    lazy val password = property[String]
    }

    // provide username and password as defined in pwd.properties
    override lazy val username = env.username.get.getOrElse(null)
    override lazy val password = env.password.get.getOrElse(null)
    }
    2 changes: 2 additions & 0 deletions pwd.properties
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    username=sa
    password=blabla