Skip to content

Commit

Permalink
Merge pull request #3 from jonas/circe-0.8.0
Browse files Browse the repository at this point in the history
Circe 0.8.0
  • Loading branch information
jonas authored Aug 19, 2017
2 parents d3f4c26 + d0bccf7 commit 06f439e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ language: scala
sudo: false

scala:
- 2.11.8
- 2.12.1
- 2.11.11
- 2.12.3

jdk: oraclejdk8

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ To release version `x.y.z` run:

> sbt release -Dproject.version=x.y.z

Then go to https://bintray.com/fonseca/maven/circe-config/x.y.z#central and sync
to Maven central.

## License

circe-config is licensed under the **[Apache License, Version 2.0][apache]** (the
Expand Down
12 changes: 6 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ homepage := Some(url("https://github.com/jonas/circe-config"))
licenses += "Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.html")
apiURL := Some(url("https://jonas.github.io/circe-config/api/"))

crossScalaVersions := Seq("2.11.8", "2.12.1")
crossScalaVersions := Seq("2.11.11", "2.12.3")
scalaVersion := crossScalaVersions.value.last

enablePlugins(GitPlugin)
Expand Down Expand Up @@ -39,11 +39,11 @@ releaseProcess := {
}

val Versions = new {
val circe = "0.7.0"
val discipline = "0.7.2"
val scalaCheck = "0.13.4"
val scalaTest = "3.0.1"
val circe = "0.8.0"
val config = "1.3.1"
val discipline = "0.8"
val scalaCheck = "0.13.5"
val scalaTest = "3.0.4"
}

libraryDependencies ++= Seq(
Expand All @@ -61,7 +61,7 @@ autoAPIMappings := true
doctestTestFramework := DoctestTestFramework.ScalaTest
doctestMarkdownEnabled := true
doctestWithDependencies := false
scalacOptions in (Compile,doc) := Seq(
scalacOptions in (Compile, doc) := Seq(
"-groups",
"-implicits",
"-doc-source-url", scmInfo.value.get.browseUrl + "/tree/master€{FILE_PATH}.scala",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ class CirceConfigLaws extends FlatSpec {
.mapObject(_.filterKeys(_.nonEmpty).withJsons(normalize))
.mapArray(_.map(normalize))
.mapNumber(number => {
def numberToDouble = {
val double = number.toDouble
if (double.isWhole)
Some(Json.fromLong(double.toLong))
else
Json.fromDouble(double)
}
// Map to the three principal types supported by Typesafe Config: Int, Long or Double
val json =
number.toInt.map(Json.fromInt) orElse
number.toLong.map(Json.fromLong) orElse
Json.fromDouble(number.toDouble) getOrElse
numberToDouble getOrElse
Json.fromInt(42)

json.asNumber.get
Expand Down

0 comments on commit 06f439e

Please sign in to comment.