Skip to content

Commit

Permalink
doc updates, conversions, howto extension, theme from akka
Browse files Browse the repository at this point in the history
  • Loading branch information
harrah committed Oct 1, 2012
1 parent b98e12e commit 3acc17d
Show file tree
Hide file tree
Showing 113 changed files with 3,713 additions and 3,560 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
target/
project/boot/
.release.sbt
__pycache__
7 changes: 2 additions & 5 deletions README.md
Expand Up @@ -59,16 +59,13 @@ This is the 0.13.x series of sbt.

## Building Documentation

Documentation is built using jekyll and sphinx and requires some external programs and libraries to be manually installed first:
Documentation is built using sphinx and requires some external programs and libraries to be manually installed first:

```text
$ pip install pygments
$ pip install sphinx
$ pip install sphinxcontrib-issuetracker
$ gem install rdiscount
$ gem install jekyll
```

To build the full site, run the `make-site` task, which will generate the manual, API, SXR, and other site pages in `target/site/`.

Individual pieces of the site may be generated using `xsbt/sphinx:mappings`, `xsbt/jekyll:mappings`, `xsbt/doc`, or `xsbt/sxr`. The output directories will be under `target/`, such as `target/sphinx`.
To only work on the site and not API or SXR, run `sphinx:mappings`.
62 changes: 38 additions & 24 deletions project/Docs.scala
@@ -1,49 +1,63 @@
import sbt._
import Keys._
import Status.{isSnapshot, publishStatus}
import com.jsuereth.sbtsite.{SitePlugin, SiteKeys}
import SitePlugin.site
import com.typesafe.sbt.{SbtGhPages,SbtGit,SbtSite,site=>sbtsite}
import SbtSite.{site, SiteKeys}
import SbtGhPages.{ghpages, GhPagesKeys => ghkeys}
import SbtGit.{git, GitKeys}
import sbtsite.SphinxSupport
import SiteKeys.{makeSite,siteMappings}
import Sxr.sxr

object Docs
{
val cnameFile = SettingKey[File]("cname-file", "Location of the CNAME file for the website.")

def settings: Seq[Setting[_]] =
site.settings ++
site.sphinxSupport("manual") ++
site.jekyllSupport() ++
site.sphinxSupport("docs") ++
site.includeScaladoc("api") ++
siteIncludeSxr ++
sitePrefixVersion
siteIncludeSxr("sxr") ++
ghPagesSettings

def siteIncludeSxr = Seq(
mappings in sxr <<= sxr.map(dir => Path.allSubpaths(dir).toSeq),
site.addMappingsToSiteDir(mappings in sxr, "sxr")
def ghPagesSettings = ghpages.settings ++ Seq(
git.remoteRepo := "git@github.com:sbt/sbt.github.com.git",
ghkeys.synchLocal <<= synchLocalImpl,
cnameFile <<= (sourceDirectory in SphinxSupport.Sphinx) / "CNAME",
GitKeys.gitBranch in ghkeys.updatedRepository := Some("master")
)

def sitePrefixVersion =
siteMappings <<= (siteMappings, version) map { (ms, v) =>
ms.map { case (src, path) => (src, v + "/" + path) }
}
def siteIncludeSxr(prefix: String) = Seq(
mappings in sxr <<= sxr.map(dir => Path.allSubpaths(dir).toSeq),
site.addMappingsToSiteDir(mappings in sxr, prefix)
)

def siteLinkLatest =
makeSite <<= (makeSite, version, streams, isSnapshot) map { (dir, v, s, snap) =>
linkSite(dir, v, if(snap) "snapshot" else "stable", s.log)
dir
}
def synchLocalImpl = (ghkeys.privateMappings, ghkeys.updatedRepository, version, isSnapshot, streams, cnameFile) map { (mappings, repo, v, snap, s, cname) =>
val versioned = repo / v
if(snap)
IO.delete(versioned)
else if(versioned.exists)
error("Site for " + v + " already exists: " + versioned.getAbsolutePath)
IO.copy(mappings map { case (file, target) => (file, versioned / target) })
IO.copyFile(cname, repo / cname.getName)
IO.touch(repo / ".nojekyll")
linkSite(repo, v, if(snap) "snapshot" else "release", s.log)
s.log.info("Copied site to " + versioned)
repo
}

def linkSite(base: File, to: String, from: String, log: Logger) {
val current = base / to
assert(current.isDirectory, "Versioned site not present at " + current.getAbsolutePath)
val symlinkFile = base / from
symlinkFile.delete()
symlink(to = current, from = symlinkFile, log = log)
val symlinkDir = base / from
symlinkDir.delete()
symlink(path = to, file = symlinkDir, log = log)
}

// TODO: platform independence/use symlink from Java 7
def symlink(to: File, from: File, log: Logger): Unit =
"ln" :: "-s" :: to.getAbsolutePath :: from.getAbsolutePath :: Nil ! log match {
def symlink(path: String, file: File, log: Logger): Unit =
"ln" :: "-s" :: path :: file.getAbsolutePath :: Nil ! log match {
case 0 => ()
case code => error("Could not create symbolic link from " + from + " to " + " to.")
case code => error("Could not create symbolic link '" + file.getAbsolutePath + "' with path " + path)
}
}
18 changes: 12 additions & 6 deletions project/Sxr.scala
Expand Up @@ -22,11 +22,17 @@ object Sxr
sxr in taskGlobal <<= sxrTask
)
def taskGlobal = ThisScope.copy(task = Global)
def sxrTask = (sources, target, scalacOptions, classpathOptions, scalaInstance, fullClasspath in sxr, streams) map { (srcs, out, opts, cpOpts, si, cp, s) =>
IO.delete(out)
IO.createDirectory(out)
val comp = new compiler.RawCompiler(si, cpOpts, s.log)
comp(srcs, cp.files, out, opts)
out.getParentFile / (out.getName + ".sxr")
def sxrTask = (sources, cacheDirectory, target, scalacOptions, classpathOptions, scalaInstance, fullClasspath in sxr, streams) map { (srcs, cache, out, opts, cpOpts, si, cp, s) =>
val outputDir = out.getParentFile / (out.getName + ".sxr")
val f = FileFunction.cached(cache / "sxr", FilesInfo.hash) { in =>
s.log.info("Generating sxr output in " + outputDir.getAbsolutePath + "...")
IO.delete(out)
IO.createDirectory(out)
val comp = new compiler.RawCompiler(si, cpOpts, s.log)
comp(in.toSeq.sorted, cp.files, out, opts)
Set(outputDir)
}
f(srcs.toSet)
outputDir
}
}
6 changes: 5 additions & 1 deletion project/p.sbt
@@ -1,3 +1,7 @@
libraryDependencies += "net.databinder" %% "dispatch-http" % "0.8.8"

addSbtPlugin("com.jsuereth" % "sbt-site-plugin" % "0.5.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "0.6.0")

resolvers += "jgit-repo" at "http://download.eclipse.org/jgit/maven"

addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.5.0")
5 changes: 0 additions & 5 deletions src/jekyll/_config.yml

This file was deleted.

31 changes: 0 additions & 31 deletions src/jekyll/_includes/footer.txt

This file was deleted.

13 changes: 0 additions & 13 deletions src/jekyll/_includes/header.txt

This file was deleted.

13 changes: 0 additions & 13 deletions src/jekyll/_includes/howto_header.txt

This file was deleted.

15 changes: 0 additions & 15 deletions src/jekyll/_includes/topbar.txt

This file was deleted.

23 changes: 0 additions & 23 deletions src/jekyll/_layouts/content.html

This file was deleted.

65 changes: 0 additions & 65 deletions src/jekyll/_layouts/default.html

This file was deleted.

25 changes: 0 additions & 25 deletions src/jekyll/_layouts/howto.html

This file was deleted.

0 comments on commit 3acc17d

Please sign in to comment.