Last active
September 8, 2017 00:17
-
-
Save mallman/5823e1a9eb5ec72b982ea93b354769e1 to your computer and use it in GitHub Desktop.
SBT Ammonite integration
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 ammoniteVersion = "1.0.2" | |
lazy val Ammonite = config("ammonite-internal").extend(Test).hide | |
ivyConfigurations += Ammonite | |
inConfig(Ammonite)(Defaults.configSettings) | |
resourceDirectories in Ammonite += (resourceDirectory in Test).value | |
fork in (Ammonite, run) := true | |
val log4jVersion = "2.8.2" | |
libraryDependencies ++= Seq( | |
"com.lihaoyi" % "ammonite" % ammoniteVersion % Ammonite cross CrossVersion.full, | |
"org.apache.logging.log4j" % "log4j-api" % log4jVersion % Ammonite, | |
"org.apache.logging.log4j" % "log4j-core" % log4jVersion % Ammonite, | |
"org.apache.logging.log4j" % "log4j-1.2-api" % log4jVersion % Ammonite, | |
"org.apache.logging.log4j" % "log4j-slf4j-impl" % log4jVersion % Ammonite | |
) | |
lazy val amm = inputKey[Unit]("Runs the Ammonite REPL.") | |
amm := { (runMain in Ammonite).partialInput(" ammonite.Main").evaluated } | |
outputStrategy in Ammonite := Some(StdoutOutput) | |
connectInput in (Ammonite, run) := true |
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
interp.load.ivy( | |
"com.lihaoyi" % | |
s"ammonite-shell_${scala.util.Properties.versionNumberString}" % | |
ammonite.Constants.version | |
) | |
@ | |
val shellSession = ammonite.shell.ShellSession() | |
import shellSession._ | |
import ammonite.ops._ | |
import ammonite.shell._ | |
ammonite.shell.Configure(interp, repl, wd) | |
val localInitPath = cwd / ".amm_init.sc" | |
if (exists(localInitPath)) { repl.load.exec(localInitPath) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment