Skip to content

Commit

Permalink
reForkOptions should include envVars.
Browse files Browse the repository at this point in the history
  • Loading branch information
danxmoran committed Jul 8, 2017
1 parent 4de4ab2 commit d81a11a
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 3 deletions.
7 changes: 7 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
sbtPlugin := true

scalacOptions := Seq("-deprecation", "-encoding", "utf8")

// Scripted test options.

scriptedSettings
scriptedLaunchOpts += s"-Dplugin.version=${version.value}"
scriptedBufferLog := false
test in Test <<= (test in Test).dependsOn(scripted.toTask(""))
2 changes: 2 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
addSbtPlugin("me.lessis" % "bintray-sbt" % "0.3.0")

libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value
4 changes: 2 additions & 2 deletions publish.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name := "sbt-revolver"

organization := "io.spray"

version := "0.8.0"
version := "0.8.0-SNAPSHOT"

description := "An SBT plugin for dangerously fast development turnaround in Scala"

Expand All @@ -18,4 +18,4 @@ publishMavenStyle := false

bintrayRepository := "sbt-plugins"

bintrayOrganization := None
bintrayOrganization := None
3 changes: 2 additions & 1 deletion src/main/scala/spray/revolver/RevolverPlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ object RevolverPlugin extends AutoPlugin {
Nil, // bootJars is empty by default because only jars on the user's classpath should be on the boot classpath
workingDirectory = Some((baseDirectory in reStart).value),
runJVMOptions = (javaOptions in reStart).value,
connectInput = false
connectInput = false,
envVars = (envVars in reStart).value
)
},

Expand Down
11 changes: 11 additions & 0 deletions src/sbt-test/sbt-revolver/env-vars/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
scalaVersion := "2.11.8"

libraryDependencies ++= Seq(
"com.typesafe.akka" %% "akka-actor" % "2.4.7",
"io.spray" %% "spray-can" % "1.3.2",
"io.spray" %% "spray-routing" % "1.3.2"
)

enablePlugins(RevolverPlugin)

envVars in reStart += "TEST_VAR" -> "OK"
1 change: 1 addition & 0 deletions src/sbt-test/sbt-revolver/env-vars/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("io.spray" % "sbt-revolver" % System.getProperty("plugin.version"))
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package spray.revolver.test

import akka.actor.{ Actor, ActorSystem, Props }
import akka.io.IO
import akka.pattern.ask
import akka.util.Timeout
import spray.can.Http
import spray.routing.HttpServiceActor

import scala.concurrent.duration._

object TestService extends App {
implicit val system = ActorSystem("test-system")
import system.dispatcher

implicit val timeout = Timeout(5.seconds)

val service = system.actorOf(Props(classOf[TestServiceActor]), "service")
IO(Http) ? Http.Bind(service, interface = "0.0.0.0", port = 8888)
}

class TestServiceActor extends HttpServiceActor {
override def receive = runRoute(route)

val route = {
get {
complete(sys.env("TEST_VAR"))
}
}
}
4 changes: 4 additions & 0 deletions src/sbt-test/sbt-revolver/env-vars/test
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
> reStart
$ sleep 2000
$ exec curl http://0.0.0.0:8888
> reStop

0 comments on commit d81a11a

Please sign in to comment.