Browse files

restore plugin

  • Loading branch information...
1 parent 0197915 commit ade4522c333ddf77f2e236ad0cdc830a0449e123 jtournay committed Jul 12, 2012
View
27 plugin/src/main/ls/0.3.2.json
@@ -0,0 +1,27 @@
+
+{
+ "organization":"net.databinder",
+ "name":"giter8-plugin",
+ "version":"0.3.2",
+ "description":"sbt 0.11 plugin for testing giter8 templates",
+ "site":"",
+ "tags":[],
+ "docs":"",
+ "licenses": [],
+ "resolvers": ["http://scala-tools.org/repo-releases"],
+ "dependencies": [{
+ "organization":"org.clapper",
+ "name": "scalasti",
+ "version": "0.5.5"
+ },{
+ "organization":"org.scala-tools.sbt",
+ "name": "sbt_2.9.1",
+ "version": "0.11.2"
+ },{
+ "organization":"org.scala-tools.sbt",
+ "name": "scripted-plugin",
+ "version": "0.11.2"
+ }],
+ "scalas": ["2.9.1"],
+ "sbt": true
+}
View
30 plugin/src/main/ls/0.4.0.json
@@ -0,0 +1,30 @@
+
+{
+ "organization":"net.databinder.giter8",
+ "name":"giter8-plugin",
+ "version":"0.4.0",
+ "description":"sbt 0.11 plugin for testing giter8 templates",
+ "site":"https://github.com/n8han/giter8",
+ "tags":[],
+ "docs":"",
+ "licenses": [{
+ "name": "LGPL v3",
+ "url": "http://www.gnu.org/licenses/lgpl.txt"
+ }],
+ "resolvers": ["http://scala-tools.org/repo-releases"],
+ "dependencies": [{
+ "organization":"org.clapper",
+ "name": "scalasti",
+ "version": "0.5.5"
+ },{
+ "organization":"org.scala-tools.sbt",
+ "name": "sbt_2.9.1",
+ "version": "0.11.2"
+ },{
+ "organization":"org.scala-tools.sbt",
+ "name": "scripted-plugin",
+ "version": "0.11.2"
+ }],
+ "scalas": ["2.9.1"],
+ "sbt": true
+}
View
30 plugin/src/main/ls/0.4.1.json
@@ -0,0 +1,30 @@
+
+{
+ "organization":"net.databinder.giter8",
+ "name":"giter8-plugin",
+ "version":"0.4.1",
+ "description":"sbt 0.11 plugin for testing giter8 templates",
+ "site":"https://github.com/n8han/giter8",
+ "tags":[],
+ "docs":"",
+ "licenses": [{
+ "name": "LGPL v3",
+ "url": "http://www.gnu.org/licenses/lgpl.txt"
+ }],
+ "resolvers": ["http://scala-tools.org/repo-releases"],
+ "dependencies": [{
+ "organization":"org.clapper",
+ "name": "scalasti",
+ "version": "0.5.5"
+ },{
+ "organization":"org.scala-tools.sbt",
+ "name": "sbt_2.9.1",
+ "version": "0.11.2"
+ },{
+ "organization":"org.scala-tools.sbt",
+ "name": "scripted-plugin",
+ "version": "0.11.2"
+ }],
+ "scalas": ["2.9.1"],
+ "sbt": true
+}
View
30 plugin/src/main/ls/0.4.2.json
@@ -0,0 +1,30 @@
+
+{
+ "organization":"net.databinder.giter8",
+ "name":"giter8-plugin",
+ "version":"0.4.2",
+ "description":"sbt 0.11 plugin for testing giter8 templates",
+ "site":"https://github.com/n8han/giter8",
+ "tags":[],
+ "docs":"",
+ "licenses": [{
+ "name": "LGPL v3",
+ "url": "http://www.gnu.org/licenses/lgpl.txt"
+ }],
+ "resolvers": ["http://scala-tools.org/repo-releases"],
+ "dependencies": [{
+ "organization":"org.clapper",
+ "name": "scalasti",
+ "version": "0.5.5"
+ },{
+ "organization":"org.scala-tools.sbt",
+ "name": "sbt_2.9.1",
+ "version": "0.11.2"
+ },{
+ "organization":"org.scala-tools.sbt",
+ "name": "scripted-plugin",
+ "version": "0.11.2"
+ }],
+ "scalas": ["2.9.1"],
+ "sbt": true
+}
View
30 plugin/src/main/ls/0.4.4.json
@@ -0,0 +1,30 @@
+
+{
+ "organization":"net.databinder.giter8",
+ "name":"giter8-plugin",
+ "version":"0.4.4",
+ "description":"sbt 0.11 plugin for testing giter8 templates",
+ "site":"https://github.com/n8han/giter8",
+ "tags":[],
+ "docs":"",
+ "licenses": [{
+ "name": "LGPL v3",
+ "url": "http://www.gnu.org/licenses/lgpl.txt"
+ }],
+ "resolvers": ["http://scala-tools.org/repo-releases"],
+ "dependencies": [{
+ "organization":"org.clapper",
+ "name": "scalasti",
+ "version": "0.5.5"
+ },{
+ "organization":"org.scala-tools.sbt",
+ "name": "sbt_2.9.1",
+ "version": "0.11.2"
+ },{
+ "organization":"org.scala-tools.sbt",
+ "name": "scripted-plugin",
+ "version": "0.11.2"
+ }],
+ "scalas": ["2.9.1"],
+ "sbt": true
+}
View
64 plugin/src/main/scala/giterate-plugin.scala
@@ -0,0 +1,64 @@
+package giter8
+
+import sbt._
+
+object Plugin extends sbt.Plugin {
+ import Keys._
+ import scala.io.Source
+ import Scripted._
+
+ object G8Keys {
+ lazy val g8 = TaskKey[Seq[File]]("g8", "Apply default parameters to input templates and write to output.")
+ lazy val outputPath = SettingKey[File]("g8-output-path")
+ lazy val propertiesFile = SettingKey[File]("g8-properties-file")
+ lazy val properties = TaskKey[Map[String, String]]("g8-properties")
+ lazy val testScript = SettingKey[File]("g8-test-script")
+ lazy val g8Test = InputKey[Unit]("g8-test", "Run `sbt test` in output to smoke-test the templates")
+ lazy val g8TestBufferLog = SettingKey[Boolean]("g8-test-buffer-log")
+ }
+
+ import G8Keys._
+
+ lazy val baseGiter8Settings: Seq[sbt.Project.Setting[_]] = Seq(
+ g8 <<= (unmanagedSourceDirectories in g8,
+ sources in g8, outputPath in g8,
+ properties in g8, streams) map { (base, srcs, out, props, s) =>
+ IO.delete(out)
+ G8(srcs x relativeTo(base), out, props) },
+ unmanagedSourceDirectories in g8 <<= (sourceDirectory) { dir => (dir / "g8").get },
+ sources in g8 <<= (unmanagedSourceDirectories in g8, propertiesFile in g8) map { (dirs, pf) =>
+ ((dirs ** (-DirectoryFilter)) --- pf).get },
+ outputPath in g8 <<= (target) { dir => dir / "g8" },
+ propertiesFile in g8 <<= (unmanagedSourceDirectories in g8) { dirs => (dirs / "default.properties").get.head },
+ properties in g8 <<= (propertiesFile in g8) map { f =>
+ Ls.lookup(GIO.readProps(new java.io.FileInputStream(f))).fold(
+ err => sys.error(err),
+ identity
+ )
+ }
+ )
+
+ lazy val giter8TestSettings: Seq[sbt.Project.Setting[_]] = scriptedSettings ++ Seq(
+ g8Test in Test <<= scriptedTask,
+ scriptedDependencies <<= (g8 in Test) map { _ => },
+ g8 in Test <<= (unmanagedSourceDirectories in g8 in Compile,
+ sources in g8 in Compile, outputPath in g8 in Test,
+ properties in g8 in Test, testScript in Test, streams) map { (base, srcs, out, props, ts, s) =>
+ IO.delete(out)
+ val retval = G8(srcs x relativeTo(base), out, props)
+
+ // copy test script or generate one
+ val script = new File(out, "test")
+ if (ts.exists) IO.copyFile(ts, script)
+ else IO.write(script, """>test""")
+ retval :+ script
+ },
+ sbtTestDirectory <<= (target) { dir => dir / "sbt-test" },
+ outputPath in g8 in Test <<= (sbtTestDirectory, name) { (dir, name) => dir / name / "scripted" },
+ testScript <<= (sourceDirectory in Test) { dir => dir / "g8" / "test" },
+ scriptedBufferLog <<= g8TestBufferLog,
+ g8TestBufferLog := true
+ )
+
+ lazy val giter8Settings: Seq[sbt.Project.Setting[_]] = inConfig(Compile)(baseGiter8Settings) ++ giter8TestSettings
+}

0 comments on commit ade4522

Please sign in to comment.