aboutsummaryrefslogtreecommitdiff
path: root/stage2
diff options
context:
space:
mode:
authorChristopher Vogt <oss.nsp@cvogt.org>2017-04-02 15:08:27 -0400
committerChristopher Vogt <oss.nsp@cvogt.org>2017-04-02 15:11:10 -0400
commitd7d924c50758aa190762672723d2b708b18911ba (patch)
tree009c1762f99586936870e306d584af253498d422 /stage2
parenta40300405524c0b4f8bf5959ec06e3fe1e93837f (diff)
downloadcbt-d7d924c50758aa190762672723d2b708b18911ba.tar.gz
cbt-d7d924c50758aa190762672723d2b708b18911ba.tar.bz2
cbt-d7d924c50758aa190762672723d2b708b18911ba.zip
Add Tut plugin
Diffstat (limited to 'stage2')
-rw-r--r--stage2/plugins/Tut.scala38
1 files changed, 38 insertions, 0 deletions
diff --git a/stage2/plugins/Tut.scala b/stage2/plugins/Tut.scala
new file mode 100644
index 0000000..f2fee14
--- /dev/null
+++ b/stage2/plugins/Tut.scala
@@ -0,0 +1,38 @@
+package cbt
+trait Tut extends BaseBuild {
+ def tut = Tut.apply( lib, context.cbtLastModified, context.paths.mavenCache, scalaMajorVersion ).config(
+ projectDirectory / "tut", target / "tut", classpath, scalacOptions
+ )
+}
+
+import java.io.File
+object Tut {
+ case class apply(
+ lib: Lib, cbtLastModified: Long, mavenCache: File, scalaMajorVersion: String
+ )(
+ implicit
+ logger: Logger, transientCache: java.util.Map[AnyRef, AnyRef], classLoaderCache: ClassLoaderCache
+ ) {
+ case class config(
+ sourceDirectory: File,
+ targetDirectory: File,
+ classpath: ClassPath,
+ scalacOptions: Seq[String],
+ fileExtensionRegex: String = """.*\.(md|txt|htm|html)""",
+ version: String = "0.4.8"
+ ) {
+ def apply =
+ lib.redirectOutToErr {
+ tut( version ).runMain(
+ "tut.TutMain",
+ Seq(
+ sourceDirectory.string, targetDirectory.string, fileExtensionRegex, "-cp", classpath.string
+ ) ++ scalacOptions
+ )
+ }
+ }
+ def tut( version: String ) = MavenResolver( cbtLastModified, mavenCache, bintray( "tpolecat" ), mavenCentral ).bindOne(
+ MavenDependency( "org.tpolecat", "tut-core_" ~ scalaMajorVersion, version )
+ )
+ }
+}