Skip to content

Instantly share code, notes, and snippets.

@Yasushi
Forked from ReSTARTR/RameeProject.scala
Created May 9, 2011 15:10
Show Gist options
  • Save Yasushi/962703 to your computer and use it in GitHub Desktop.
Save Yasushi/962703 to your computer and use it in GitHub Desktop.
DotCloud sbt Project sample
import sbt._
class AppnameProject(info: ProjectInfo) extends DefaultWebProject(info) {
val JETTY7 = "7.3.1.v20110307"
val servletapi = "javax.servlet" % "servlet-api" % "2.5" % "compile"
val jetty7Server = "org.eclipse.jetty" % "jetty-server" % JETTY7 % "provided,test"
val jetty7Servlets = "org.eclipse.jetty" % "jetty-servlets" % JETTY7 % "provided,test"
val jetty7Webapp = "org.eclipse.jetty" % "jetty-webapp" % JETTY7 % "provided,test"
val copyDirectory = path("release")
val copyFileName = copyDirectory / "root.war"
val dotApplicationName = "APPNAME"
val dotServiceName = dotApplicationName + ".SERVNAME"
import Process._
lazy val dot_create = task {
val lists:Stream[String] = "dotcloud list" lines_!;
def exists(x:String) = { lists.exists( _.indexOf(x)>=0) }
if(!exists(dotApplicationName)) {
"dotcloud create " + dotApplicationName ! log
} else {
log.warn("application is already exists.: " + dotApplicationName )
}
if(!exists(dotServiceName)) {
val res = "dotcloud deploy -t java " + dotServiceName !!;
if(res.indexOf("Created") >= 0) {
log.info("success to deproy")
None
} else {
Some("fail to deproy")
}
} else {
log.warn("service is already exists.")
None
}
}
lazy val dot_prepare = task {
log.info( "copy " + warPath + " to " + copyFileName )
FileUtilities.createDirectories(Seq(copyDirectory), log)
FileUtilities.copyFile(warPath, copyFileName, log)
}
lazy val dot_push = task {
import Process._
log.info("push to dotcloud")
"dotcloud push ramee.www target/release/" ! log; None
}.dependsOn(`package`, dot_prepare)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment