Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
126 additions
and
120 deletions.
There are no files selected for viewing
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* switched to sbt 0.11 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package giter8 | ||
|
||
import sbt._ | ||
|
||
object G8 { | ||
import scala.collection.JavaConversions._ | ||
import org.antlr.stringtemplate.StringTemplate | ||
import java.util.{Map=>JMap} | ||
|
||
def apply(fromMapping: Seq[(File,String)], toPath: File, params: Map[_,_], log: Logger): Seq[File] = { | ||
val jParams = new java.util.HashMap[Any,Any]() | ||
for { (k, v) <- params.elements } jParams.put(k, v) | ||
apply(fromMapping, toPath, jParams, log) | ||
} | ||
def apply(fromMapping: Seq[(File,String)], toPath: File, params: JMap[_,_], log: Logger): Seq[File] = | ||
fromMapping filter { !_._1.isDirectory } flatMap { case (in, relative) => | ||
apply(in, expandPath(relative, toPath, params), params, log) | ||
} | ||
def apply(in: File, out: File, params: JMap[_,_], log: Logger): Seq[File] = { | ||
log.debug("Applying " + in) | ||
val st = new StringTemplate | ||
var parseError = false | ||
st.setErrorListener(new org.antlr.stringtemplate.StringTemplateErrorListener { | ||
def error(msg: String, exc: Throwable) { parseError = true } | ||
def warning(msg: String) { } | ||
}) | ||
st.setTemplate(IO.read(in)) | ||
if (parseError) { | ||
log.info("Unable to parse template %s, copying unmodified" format in) | ||
IO.copyFile(in, out) | ||
} else { | ||
st.setAttributes(params: JMap[_,_]) | ||
IO.write(out, st.toString) | ||
} | ||
Seq(out) | ||
} | ||
private def expandPath(relative: String, toPath: File, params: JMap[_,_]): File = { | ||
val out = new StringTemplate(relative) | ||
out.setAttributes(params) | ||
new File(toPath, out.toString) | ||
} | ||
} |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import sbt._ | ||
|
||
object Builds extends sbt.Build { | ||
import Keys._ | ||
|
||
lazy val buildSettings = Defaults.defaultSettings ++ Seq( | ||
version := "0.2.3-SNAPSHOT", | ||
organization := "net.databinder", | ||
scalaVersion := "2.9.1", | ||
crossScalaVersions := Seq("2.9.1"), | ||
publishArtifact in (Compile, packageBin) := true, | ||
publishArtifact in (Test, packageBin) := false, | ||
publishArtifact in (Compile, packageDoc) := false, | ||
publishArtifact in (Compile, packageSrc) := false, | ||
publishTo <<= version { (v: String) => | ||
val nexus = "http://nexus.scala-tools.org/content/repositories/" | ||
if(v endsWith "-SNAPSHOT") Some("Scala Tools Nexus" at nexus + "snapshots/") | ||
else Some("Scala Tools Nexus" at nexus + "releases/") | ||
}, | ||
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials"), | ||
publishMavenStyle := true | ||
) | ||
|
||
// posterous title needs to be giter8, so both app and root are named giter8 | ||
lazy val root = Project("giter8", file(".")) | ||
lazy val app = Project("giter8", file("app"), | ||
settings = buildSettings ++ Seq( | ||
libraryDependencies ++= { | ||
Seq("org.scala-tools.sbt" % "launcher-interface" % "0.7.4" % "provided", | ||
"net.databinder" %% "dispatch-lift-json" % "0.8.5", | ||
"org.clapper" %% "scalasti" % "0.5.5") | ||
} | ||
)) | ||
lazy val plugin = Project("giter8-plugin", file("plugin"), | ||
settings = buildSettings ++ Seq( | ||
sbtPlugin := true, | ||
libraryDependencies <++= (sbtDependency) { sd => | ||
Seq(sd, "org.antlr" % "stringtemplate" % "3.2.1") | ||
} | ||
)) | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.