Skip to content

Commit

Permalink
SBT task to generate and browse to the Scaladoc.
Browse files Browse the repository at this point in the history
For example:

> core/show-doc
  • Loading branch information
retronym committed Nov 12, 2011
1 parent 955dfc1 commit ca5e024
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions project/build.scala
Original file line number Original file line Diff line number Diff line change
@@ -1,10 +1,12 @@
import java.awt.Desktop
import sbt._ import sbt._
import Keys._ import Keys._
import GenTypeClass._ import GenTypeClass._
import Project.Setting import Project.Setting


object build extends Build { object build extends Build {
type Sett = Project.Setting[_] type Sett = Project.Setting[_]
lazy val showDoc = TaskKey[Unit]("show-doc")


lazy val standardSettings: Seq[Sett] = Defaults.defaultSettings ++ Seq[Sett]( lazy val standardSettings: Seq[Sett] = Defaults.defaultSettings ++ Seq[Sett](
organization := "org.scalaz", organization := "org.scalaz",
Expand All @@ -22,6 +24,10 @@ object build extends Build {
} }
}, },
typeClasses := Seq(), 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 { genToSyntax <<= (typeClasses) map {
(tcs: Seq[TypeClass]) => (tcs: Seq[TypeClass]) =>
val objects = tcs.map(tc => "object %s extends To%sSyntax".format(Util.initLower(tc.name), tc.name)).mkString("\n") val objects = tcs.map(tc => "object %s extends To%sSyntax".format(Util.initLower(tc.name), tc.name)).mkString("\n")
Expand Down

0 comments on commit ca5e024

Please sign in to comment.