Skip to content

Commit

Permalink
Switch to sbt-microsites circe#438
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas committed Nov 22, 2016
1 parent 65be938 commit ceab148
Show file tree
Hide file tree
Showing 25 changed files with 113 additions and 766 deletions.
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
layout: docs
title: "Contributing"
position: 6
---

# Guide for contributors

This project follows a standard [fork and pull][fork-and-pull] model for accepting contributions via
Expand Down
30 changes: 22 additions & 8 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,27 @@ def noDocProjects(sv: String): Seq[ProjectReference] = Seq[ProjectReference](
}
)

val docMappingsApiDir = settingKey[String]("Subdirectory in site target directory for API docs")
val docMappingsTutDir = settingKey[String]("Subdirectory in site target directory for Tut docs")

lazy val docSettings = allSettings ++ tutSettings ++ ghpages.settings ++ unidocSettings ++ Seq(
docMappingsApiDir := "api",
docMappingsTutDir := "_tut",
addMappingsToSiteDir(mappings in (ScalaUnidoc, packageDoc), docMappingsApiDir),
addMappingsToSiteDir(tut, docMappingsTutDir),
lazy val docSettings = allSettings ++ unidocSettings ++ Seq(
micrositeName := "circe",
micrositeDescription := "A JSON library for Scala powered by Cats",
micrositeAuthor := "Travis Brown",
micrositeHighlightTheme := "atom-one-light",
micrositeHomepage := "https://circe.github.io/circe/",
micrositeBaseUrl := "circe",
micrositeDocumentationUrl := "api",
micrositeGithubOwner := "circe",
micrositeGithubRepo := "circe",
micrositeExtraMdFiles := Map(file("CONTRIBUTING.md") -> "contributing.md"),
micrositePalette := Map(
"brand-primary" -> "#5B5988",
"brand-secondary" -> "#292E53",
"brand-tertiary" -> "#222749",
"gray-dark" -> "#49494B",
"gray" -> "#7B7B7E",
"gray-light" -> "#E5E5E6",
"gray-lighter" -> "#F4F3F4",
"white-color" -> "#FFFFFF"),
addMappingsToSiteDir(mappings in (ScalaUnidoc, packageDoc), micrositeDocumentationUrl),
ghpagesNoJekyll := false,
scalacOptions in (ScalaUnidoc, unidoc) ++= Seq(
"-groups",
Expand All @@ -125,6 +138,7 @@ lazy val docs = project.dependsOn(core, generic, parser, optics)
.settings(
addCompilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
)
.enablePlugins(MicrositesPlugin)

lazy val aggregatedProjects: Seq[ProjectReference] = Seq[ProjectReference](
numbers, numbersJS,
Expand Down
11 changes: 11 additions & 0 deletions docs/src/main/resources/microsite/css/override.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.technologies {
display: none;
}

.jumbotron {
background-image: none;
}

.sidebar-nav > .sidebar-brand a .brand-wrapper {
background-size: 36px 36px !important;
}
19 changes: 19 additions & 0 deletions docs/src/main/resources/microsite/data/menu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
options:

- title: Parsing JSON
url: parsing.html

- title: Traversing and modifying JSON
url: cursors.html

- title: Encoding and decoding
url: codec.html

- title: Optics
url: optics.html

- title: Performance
url: performance.html

- title: Guide for contributors
url: contributing.html
File renamed without changes
13 changes: 13 additions & 0 deletions docs/src/main/resources/microsite/img/circe_alt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions docs/src/main/resources/microsite/img/circe_navbar_brand.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
12 changes: 6 additions & 6 deletions docs/src/main/tut/codec.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: default
layout: docs
title: "Encoding and decoding"
section: "codec"
position: 3
---

# Encoding and decoding
Expand Down Expand Up @@ -38,7 +38,7 @@ decode[List[Int]]("[1, 2, 3]")

## Semi-automatic derivation

Sometimes it's convenient to have an `Encoder` or `Decoder` defined in your code, and semi-automatic
Sometimes it's convenient to have an `Encoder` or `Decoder` defined in your code, and semi-automatic
derivation can help. You'd write:

```tut:silent
Expand Down Expand Up @@ -76,7 +76,7 @@ NOTE: You will need the [Macro Paradise](http://docs.scala-lang.org/overviews/ma

### forProductN helper methods

It's also possible to construct encoders and decoders for case class-like types
It's also possible to construct encoders and decoders for case class-like types
in a relatively boilerplate-free way without generic derivation:

```tut:silent
Expand Down Expand Up @@ -147,7 +147,7 @@ implicit val decodeInstant: Decoder[Instant] = Decoder.decodeString.emap { str =

## Custom key types

If you need to encode/decode `Map[K, V]` where `K` is not `String` (or `Symbol`, `Int`, `Long`, etc.),
If you need to encode/decode `Map[K, V]` where `K` is not `String` (or `Symbol`, `Int`, `Long`, etc.),
you need to provide a `KeyEncoder` and/or `KeyDecoder` for your custom key type.

For example:
Expand Down Expand Up @@ -177,7 +177,7 @@ json.as[Map[Foo, Int]]
## Warnings and known issues

1. Please note that generic derivation will not work on Scala 2.10 unless you've added the [Macro
Paradise][paradise] plugin to your build. See the [quick start section on the home page]({{ site.baseurl }}/index.html#quick-start)
Paradise][paradise] plugin to your build. See the [quick start section on the home page]({{ site.baseurl }}/index.html#quick-start)
for details.

2. Generic derivation may not work as expected when the type definitions that you're trying to
Expand Down
6 changes: 3 additions & 3 deletions docs/src/main/tut/cursors.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: default
layout: docs
title: "Traversing and modifying JSON"
section: "cursors"
position: 2
---

# Traversing and modifying JSON
Expand Down Expand Up @@ -57,7 +57,7 @@ val secondQux: Decoder.Result[String] =

## Transforming data

We can also use a cursor to modify JSON.
We can also use a cursor to modify JSON.

```tut:silent
val reversedNameCursor: ACursor =
Expand Down
14 changes: 7 additions & 7 deletions docs/src/site/index.md → docs/src/main/tut/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
layout: default
layout: home
title: "Home"
section: "home"
---
Expand All @@ -12,12 +12,12 @@ section: "home"
circe (pronounced SUR-see, or KEER-kee in classical Greek, or CHEER-chay in Ecclesiastical Latin) is
a JSON library for Scala (and [Scala.js][scala-js]).

circe's working title was jfc, which stood for "JSON for [cats][cats]". The name was changed for
circe's working title was jfc, which stood for "JSON for [cats][cats]". The name was changed for
[a number of reasons](https://github.com/travisbrown/circe/issues/11).

<a name="quick-start"></a>

{% include_relative _tut/quickstart.md %}
{% include_relative quickstart.md %}

## Why?

Expand Down Expand Up @@ -48,20 +48,20 @@ fussiest code in Argonaut. The [`jackson`][circe-jackson] subproject supports us
circe also provides a [`parser`][circe-parser] subproject that provides parsing support for Scala.js,
with JVM parsing provided by `io.circe.jawn` and JavaScript parsing from `scalajs.js.JSON`.

See the [Parsing page](tut/parsing.html) for more details.
See the [Parsing page](parsing.html) for more details.

### Lenses

circe doesn't use or provide lenses in the `core` project. This is related to the first point above,
since [Monocle][monocle] has a Scalaz dependency, but we also feel that it simplifies the API. The
0.3.0 release added [an experimental `optics` subproject][optics-pr] that provides Monocle lenses.

See the [Optics page](tut/optics.html) for more details.
See the [Optics page](optics.html) for more details.

### Codec derivation

circe does not use macros or provide any kind of automatic derivation in the `core` project. Instead
of Argonaut's limited macro-based derivation (which does not support sealed trait hierarchies, for
of Argonaut's limited macro-based derivation (which does not support sealed trait hierarchies, for
example), circe includes a subproject (`generic`) that provides generic codec derivation using
[Shapeless][shapeless].

Expand All @@ -70,7 +70,7 @@ example), circe includes a subproject (`generic`) that provides generic codec de
case classes and sealed trait hierarchies. It also includes derivation of "incomplete" case class
instances (see my recent [blog post][incompletes] for details).

See the [Encoding and Decoding page](tut/codec.html) for more details.
See the [Encoding and Decoding page](codec.html) for more details.

### Aliases

Expand Down
16 changes: 8 additions & 8 deletions docs/src/main/tut/optics.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
layout: default
layout: docs
title: "Optics"
section: "optics"
position: 4
---

# Optics

Optics are a powerful tool for traversing and modifying JSON documents. They can reduce boilerplate
Optics are a powerful tool for traversing and modifying JSON documents. They can reduce boilerplate
considerably, especially if you are working with deeply nested JSON.

circe provides support for optics by integrating with [Monocle](monocle). To use them, add a
Expand Down Expand Up @@ -72,8 +72,8 @@ val _phoneNum = root.order.customer.contactDetails.phone.string
val phoneNum: Option[String] = _phoneNum.getOption(json)
```

Note the difference between cursors and optics. With cursors, we start with a JSON document, get a
cursor from it, and then use that cursor to traverse the document. With optics, on the other hand,
Note the difference between cursors and optics. With cursors, we start with a JSON document, get a
cursor from it, and then use that cursor to traverse the document. With optics, on the other hand,
we first define the traversal we want to make, then apply it to a JSON document.

In other words, optics provide a way to separate the description of a JSON traversal from its
Expand All @@ -98,7 +98,7 @@ val quantities: Seq[Int] =
And with optics:

```tut:book
val items: Seq[Int] =
val items: Seq[Int] =
root.order.items.each.quantity.int.getAll(json)
```

Expand All @@ -110,9 +110,9 @@ Suppose we decide to have a 2-for-1 sale, so we want to double all the quantitie
can be achieved with a small change to the code we wrote for traversal:

```tut:book
val doubleQuantities: Json => Json =
val doubleQuantities: Json => Json =
root.order.items.each.quantity.int.modify(_ * 2)
val modifiedJson = doubleQuantities(json)
```

Expand Down
4 changes: 2 additions & 2 deletions docs/src/main/tut/parsing.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: default
layout: docs
title: "Parsing JSON"
section: "parsing"
position: 1
---

# Parsing JSON
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: default
layout: docs
title: "Performance"
section: "performance"
position: 5
---

# Performance
Expand Down
14 changes: 0 additions & 14 deletions docs/src/site/_config.yml

This file was deleted.

Loading

0 comments on commit ceab148

Please sign in to comment.