new `jetty` action that waits for a key press before terminating (intended to be used from batch-style)

git-svn-id: https://simple-build-tool.googlecode.com/svn/trunk@828 d89573ee-9141-11dd-94d4-bdf5e562f29c
This commit is contained in:
dmharrah 2009-07-01 04:57:20 +00:00
parent aa4b084ecc
commit 4886d95efa
2 changed files with 18 additions and 2 deletions

View File

@ -9,7 +9,7 @@ Name:
Organization []:
Version [1.0]:
Scala version [2.7.5]:
sbt version [0.5]:
sbt version [0.5.1]:
*/
import java.io.File
/** Constants related to reading/writing the build.properties file in a project.
@ -48,7 +48,7 @@ private object ProjectProperties
/** The default version of the new user project when the user doesn't explicitly specify a version when prompted.*/
val DefaultVersion = "1.0"
/** The default version of sbt when the user doesn't explicitly specify a version when prompted.*/
val DefaultSbtVersion = "0.5"
val DefaultSbtVersion = "0.5.1"
/** The default version of Scala when the user doesn't explicitly specify a version when prompted.*/
val DefaultScalaVersion = "2.7.5"

View File

@ -315,8 +315,22 @@ abstract class BasicWebScalaProject extends BasicScalaProject with WebScalaProje
def jettyRunClasspath = testClasspath
def jettyWebappPath = temporaryWarPath
lazy val jettyRun = jettyRunAction
lazy val jetty = task { idle() } dependsOn(jettyRun) describedAs(JettyDescription)
protected def jettyRunAction =
jettyRunTask(jettyWebappPath, jettyContextPath, jettyPort, jettyRunClasspath, "test", scanDirectories.map(_.asFile), scanInterval) dependsOn(prepareWebapp) describedAs(JettyRunDescription)
private def idle() =
{
log.info("Waiting... (press any key to interrupt)")
def doWait()
{
try { Thread.sleep(1000) } catch { case _: InterruptedException => () }
if(System.in.available() <= 0)
doWait()
}
doWait()
while (System.in.available() > 0) System.in.read()
None
}
/** The directories that should be watched to determine if the web application needs to be reloaded..*/
def scanDirectories: Seq[Path] = jettyWebappPath :: Nil
@ -408,6 +422,8 @@ object BasicWebScalaProject
"Stops the Jetty server that was started with the jetty-run action."
val JettyRunDescription =
"Starts the Jetty server and serves this project as a web application."
val JettyDescription =
"Starts the Jetty server and serves this project as a web application. Waits until interrupted, so it is suitable to call this batch-style."
}
/** Analyzes the dependencies of a project after compilation. All methods except `snapshot` return a
* `PathFinder`. The underlying calculations are repeated for each call to PathFinder.get. */