Ornate 0.6 Manual

Running

Ornate is available in JCenter and Maven Central. The sbt plugin is published to the standard sbt plugin repository.

SBT Plugin

Ornate 0.6+ supports sbt 1.x. Older versions of Ornate support sbt 0.13.

First you need to add Ornate’s sbt plugin to project/plugins.sbt:

addSbtPlugin("com.novocode" % "sbt-ornate" % "0.6")

A minimum project definition in build.sbt which enables the plugin looks like this:

lazy val root = project.in(file("."))
  .enablePlugins(OrnatePlugin)
build.sbt

You can run Ornate from sbt with the ornate task. By default it looks for a config file src/ornate.conf, source and resources under src/doc, and it builds the site to target/doc. These settings can be changed directly through the sbt configuration:

val ornateBaseDir     = settingKey[Option[File]]("Base directory for Ornate")
val ornateSourceDir   = settingKey[Option[File]]("Source directory for Ornate")
val ornateResourceDir = settingKey[Option[File]]("Resource directory for Ornate")
val ornateTargetDir   = settingKey[Option[File]]("Target directory for the Ornate-generated site")
val ornateConfig      = settingKey[File]("Config file for Ornate")
val ornateSettings    = settingKey[Map[String, String]]("Extra settings for Ornate")
val ornate            = taskKey[File]("Run Ornate to generate the site, returning the target directory")
lazy val Ornate       = config("ornate").hide // provides the classpath for Ornate
OrnatePlugin.scala

Only the location of the config file is required. The base / source / resource / target directories are set by default, so they override any settings made in the config file. You can explicitly set them to None to make the settings from the config file take effect instead.

Command Line

You need to get the Ornate core package and its dependencies in order to run Ornate from the command line:

libraryDependencies += "com.novocode" %% "ornate" % "0.6"
<dependency>
  <groupId>com.novocode</groupId>
  <artifactId>ornate_2.11</artifactId>
  <version>0.6</version>
</dependency>

Note: Ornate requires Scala 2.11

The main class for the command line launcher is com.novocode.ornate.Main. The following arguments are supported:

  • [--base-dir=<path>]: Source, resource and target dirs in the config are relative to the base directory. If not specified explicitly, this is the directory that contains the config file.
  • [-D<option>=<value>...]: Configuration options can be overridden with -D arguments or through system properties.
  • <config-file>: The path to the site config file, typically named ornate.conf.

All further configuration is done through the config file.

Cleaning

Cleaning the target directory is performed with a special theme, com.novocode.ornate.theme.Clean. On the command line you can invoke it with -Dglobal.theme=clean. Excluded resources can be configured:

# Theme-specific settings for the clean theme
theme.clean.global {
  # Array of gitignore-style patterns matching resources that should not be deleted
  ignore = [".git"]
}
ornate-reference.conf

When using the sbt plugin, the generated site is placed under target/doc by default, so it can be deleted along with all other generated resources with sbt’s standard clean task.