Permalink
Browse files

SBT task to generate and browse to the Scaladoc.

For example:

> core/show-doc
  • Loading branch information...
1 parent 955dfc1 commit ca5e024d0762e8ce6fff6c2855c42ea4ec6541b5 @retronym committed Nov 12, 2011
Showing with 6 additions and 0 deletions.
  1. +6 −0 project/build.scala
View
@@ -1,10 +1,12 @@
+import java.awt.Desktop
import sbt._
import Keys._
import GenTypeClass._
import Project.Setting
object build extends Build {
type Sett = Project.Setting[_]
+ lazy val showDoc = TaskKey[Unit]("show-doc")
lazy val standardSettings: Seq[Sett] = Defaults.defaultSettings ++ Seq[Sett](
organization := "org.scalaz",
@@ -22,6 +24,10 @@ object build extends Build {
}
},
typeClasses := Seq(),
+ showDoc in Compile <<= (doc in Compile, target in doc in Compile) map { (_, out) =>
+ val index = out / "index.html"
+ if (index.exists()) Desktop.getDesktop.open(out / "index.html")
+ },
genToSyntax <<= (typeClasses) map {
(tcs: Seq[TypeClass]) =>
val objects = tcs.map(tc => "object %s extends To%sSyntax".format(Util.initLower(tc.name), tc.name)).mkString("\n")

0 comments on commit ca5e024

Please sign in to comment.