Created
June 2, 2014 19:17
-
-
Save pedrofurla/f5e3da72188acae96bd5 to your computer and use it in GitHub Desktop.
Custom config and task for multiple initialCommands in SBT Scala console
This file contains hidden or 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
| val hconfig = config("hconfig").extend(Compile) | |
| lazy val hconsole = taskKey[Unit]("hconsole") | |
| lazy val destroySchema = taskKey[Unit]("destroySchema") | |
| hconsole := (console in hconfig).value | |
| val slickperf = project.in(file(".")). | |
| configs(hconfig). | |
| settings(inConfig(hconfig)(Defaults.configTasks) : _*) | |
| fork.in(hconfig,console) := true | |
| initialCommands in hconfig := | |
| """ | |
| |import exec._ | |
| |import exec.TestHelper._ | |
| |import support.JpaInstances.HibernateJpa | |
| |import scalaz._ | |
| |import Scalaz._ | |
| | | |
| |import collection.JavaConversions._ | |
| | | |
| |import jpaperf._ | |
| |import jpaperf.Entities._ | |
| | | |
| |val slick = support.SlickInstances.SlickMySql | |
| |slick.createSchema | |
| | | |
| |val jpa = HibernateJpa | |
| |val em = jpa.defaultEm | |
| |val ic = new JpaInsertCompanyEmployee(jpa) | |
| |ic.run(Nel(3)) | |
| """.stripMargin | |
| cleanupCommands in hconfig := | |
| """ | |
| |jpa.emFactory.close() | |
| |slick.destroySchema | |
| """.stripMargin |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment