Skip to content
This repository was archived by the owner on Aug 17, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
b03b007
moved to iheartradio org
kailuowang Dec 9, 2015
f2d6585
Merge pull request #1 from kailuowang/master
kailuowang Dec 9, 2015
b10d6ad
Setting version to 1.1.3
kailuowang Dec 9, 2015
f336758
Setting version to 1.2.0-SNAPSHOT
kailuowang Dec 9, 2015
e4d4d7a
Update README.md
kailuowang Dec 9, 2015
8c647eb
bump scala version
joprice Dec 9, 2015
5f54faf
Merge pull request #2 from joprice/bumpScalaVersion
kailuowang Dec 10, 2015
2adeb26
updated readme with new versions
kailuowang Dec 10, 2015
fba5f80
lifted com.typesafe's config library to 1.3.0
mreif Dec 16, 2015
aee2a18
set jdk used by travis to java 8
mreif Dec 16, 2015
92f7f57
added jvm-1.8 as target vm
mreif Dec 16, 2015
b45f4ab
changed name of openjdk8
mreif Dec 16, 2015
2129b74
removed MaxPermSize specification
mreif Dec 16, 2015
016d5df
removed openjdk8 this is not supported by the jvm-switcher
mreif Dec 16, 2015
83a13e1
restored orignal version for scala 2.10
mreif Dec 16, 2015
57a067f
Merge pull request #6 from mreif/master
kailuowang Dec 16, 2015
5927bec
updated readme for new release
kailuowang Dec 16, 2015
4eea3f2
Setting version to 1.2.0
kailuowang Dec 16, 2015
60c5ee1
Setting version to 1.2.1-SNAPSHOT
kailuowang Dec 16, 2015
e413c0d
updated readme
kailuowang Dec 16, 2015
0a9af5d
add openjdk8 back to travis / update travis to the new trusty env
kailuowang Dec 16, 2015
bf8e303
Merge pull request #7 from kailuowang/master
kailuowang Dec 16, 2015
4ebd883
github #9: add function getOrElse
Dec 22, 2015
093b764
switched default to by name
Dec 22, 2015
3532651
Merge pull request #10 from thurstonsand/master
kailuowang Dec 22, 2015
538d73b
added the download badge
kailuowang Dec 22, 2015
52be8e8
Merge pull request #11 from kailuowang/master
kailuowang Dec 22, 2015
7058d25
Setting version to 1.2.1
kailuowang Dec 22, 2015
2ccd41e
Setting version to 1.2.2-SNAPSHOT
kailuowang Dec 22, 2015
12e4519
added codacy
kailuowang Dec 23, 2015
6fe7cd0
Merge pull request #12 from kailuowang/master
kailuowang Dec 23, 2015
83dab85
Add EnumerationReader to support Scala's Enumeration type
akkie Nov 13, 2015
dd3e8c8
Merge pull request #14 from akkie/enum
kailuowang Feb 16, 2016
3954137
Setting version to 1.2.2
kailuowang Feb 16, 2016
e3b9260
Setting version to 1.2.3-SNAPSHOT
kailuowang Feb 16, 2016
e45bba2
ZonedDateTime reader in ISO format
larroy Feb 28, 2016
e7192e2
Remove unused imports
larroy Feb 28, 2016
8244465
Merge pull request #16 from larroy/master
kailuowang Feb 28, 2016
ab07339
Setting version to 1.2.3
kailuowang Feb 28, 2016
1db1482
Setting version to 1.2.4-SNAPSHOT
kailuowang Feb 28, 2016
835928e
Overall dependency bumps, mainly shapeless 2.3.0
guersam Apr 11, 2016
0f5a627
Merge pull request #17 from guersam/tmp/bump-dependencies
kailuowang Apr 11, 2016
3621ab4
Fix version
vitornp Apr 29, 2016
b5fcfb3
Merge pull request #18 from vitornp/patch-1
kailuowang Apr 29, 2016
1360c17
fixed bug where user-defined ValueReaders don't work with getOrElse
May 6, 2016
974b5b1
Merge pull request #19 from thurstonsand/master
kailuowang May 6, 2016
75f6a9f
Setting version to 1.2.4
kailuowang May 6, 2016
8de49e0
Setting version to 1.2.5-SNAPSHOT
kailuowang May 6, 2016
359bc71
add cross scala versions to support 2.10 (#21)
joprice May 13, 2016
9ccfccb
enable cross build in release and remove test failing on 2.10 (#23)
joprice May 13, 2016
8702a10
ArbitraryTypeReader.NameMapper (#22)
shanielh May 13, 2016
fd1a72d
added gitter badge
kailuowang May 13, 2016
3019d70
Setting version to 1.2.5
joprice May 13, 2016
ecb1d90
Setting version to 1.2.6-SNAPSHOT
joprice May 13, 2016
ee17320
remove the binary breaking change that didnt fix anything but still …
kailuowang May 19, 2016
b442be5
Setting version to 1.2.6
kailuowang May 19, 2016
00eafb9
Setting version to 1.2.7-SNAPSHOT
kailuowang May 19, 2016
68a9dcd
Add SymbolReader (#28)
ocadaruma May 27, 2016
01f948b
Move name mapper and related into separate package
aeons Sep 27, 2016
a2311bf
Add hyphen case name mapper (fixes #25)
aeons Sep 27, 2016
ff3653f
Merge pull request #33 from aeons/master
kailuowang Sep 27, 2016
92727a1
Setting version to 1.2.7
kailuowang Sep 27, 2016
53f4afa
Setting version to 1.2.8-SNAPSHOT
kailuowang Sep 27, 2016
9eef0c6
Setting version to 1.3.0
kailuowang Oct 5, 2016
e6ad007
Setting version to 1.3.1-SNAPSHOT
kailuowang Oct 5, 2016
24824f5
Prepare deploying to Sonatype
Oct 22, 2016
9b57010
switch to coveralls (#36)
kailuowang Nov 3, 2016
6417522
update license name
kailuowang Nov 7, 2016
92c01ed
Configure cross-compilation to Scala 2.12 (#35)
jakubjanecek Nov 7, 2016
bf14415
Setting version to 1.3.2
kailuowang Nov 7, 2016
0c9f855
Setting version to 1.3.3-SNAPSHOT
kailuowang Nov 7, 2016
68304aa
updated readme with version change (#38)
kailuowang Nov 8, 2016
af0ebd5
Hyphen example (#40)
kailuowang Nov 9, 2016
173ad09
Setting version to 1.3.3
kailuowang Nov 9, 2016
44793c9
Setting version to 1.3.4-SNAPSHOT
kailuowang Nov 9, 2016
cc3250d
Read finite duration from nanos to keep unit
Nov 15, 2016
987ed2e
Merge pull request #41 from iantabolt/master
kailuowang Nov 16, 2016
285fe24
use iheartradio binray repo in readme instead
kailuowang Nov 16, 2016
f81775d
Allow sonatype to be used together with sbt-release
Nov 21, 2016
a07f96a
Merge pull request #34 from leonardehrenfried/master
kailuowang Nov 21, 2016
5e202ea
Move to sonatype (#43)
kailuowang Nov 21, 2016
ae15aeb
eitherReader: valueReader implementation for Either[A,B] given A and …
eyalfa Nov 24, 2016
e8c8eb6
eitherReader: minor test utility.
eyalfa Nov 24, 2016
319032a
eitherReader: test spec for either.
eyalfa Nov 24, 2016
d7ee906
eitherReader: removed auto generated ide comments
eyalfa Nov 26, 2016
e7c23dd
eitherReader: minor fixes according to review comments.
eyalfa Nov 28, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
language: scala
sudo: required
dist: trusty

scala:
- 2.11.0
- 2.10.6
- 2.11.8
- 2.12.0
jdk:
- openjdk7
- oraclejdk7
- oraclejdk8
- openjdk8
cache:
directories:
- $HOME/.ivy2/cache
- $HOME/.sbt/boot/

install: /bin/true
script: ./sbt -J-Xss1M -J-Xms512M -J-Xmx512M -J-XX:MaxPermSize=128M ";clean;compile;test"

script:
- sbt ++$TRAVIS_SCALA_VERSION mimaReportBinaryIssues
- sbt ++$TRAVIS_SCALA_VERSION -jvm-opts travis-jvmopts clean coverage test coverageReport
- sbt ++$TRAVIS_SCALA_VERSION coveralls
100 changes: 75 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
# Warning: abandoned project #
I have been neglecting Ficus for several reasons:
* At work we use [knobs](http://oncue.github.io/knobs/)
* I am a bit oversubscribed on open source projects
* Ficus scratched an itch when I first wrote it, but if I were to write it again right now, I would approach it differently.
* I would represent errors explicitly in the types (currently it throws exceptions, which can be handy, but I would want an alternative).
* I would use [Shapeless](https://github.com/milessabin/shapeless) to derive readers instead of a macro. At the time, the macro was necessary to use default values on classes, but Shapeless now provides full support for this.
* I think I would end up writing a `shapeless-knobs` micro library that simply provides Shapeless-derived [Configured](https://github.com/oncue/knobs/blob/master/core/src/main/scala/knobs/Configured.scala) instances.

Having said that, I know there are a number of people that are happily using Ficus. I'm happy to hand this project off to a good owner. The only difficulty might be in publishing credentials. Since its currently under `net.ceedubs`, the simplest option may be to have a fork and start publishing in a different namespace. I'm happy to update the repo to redirect to the new official project. Please email me at my GitHub handle at gmail if you'd like to volunteer to take over this project.
Official repo for ficus. Adopted from [ceedubs](https://github.com/ceedubs/ficus)

# Ficus #
Ficus is a lightweight companion to Typesafe config that makes it more Scala-friendly.

Ficus adds an `as[A]` method to a normal [Typesafe Config](http://typesafehub.github.io/config/latest/api/com/typesafe/config/Config.html) so you can do things like `config.as[Option[Int]]`, `config.as[List[String]]`, or even `config.as[MyClass]`. It is implemented with type classes so that it is easily extensible and many silly mistakes can be caught by the compiler.

[![Build Status](https://secure.travis-ci.org/ceedubs/ficus.png?branch=master)](http://travis-ci.org/ceedubs/ficus)
[![Build Status](https://secure.travis-ci.org/iheartradio/ficus.png?branch=master)](http://travis-ci.org/iheartradio/ficus)
[![Join the chat at https://gitter.im/iheartradio/ficus](https://badges.gitter.im/iheartradio/ficus.svg)](https://gitter.im/iheartradio/ficus?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Coverage Status](https://coveralls.io/repos/github/iheartradio/ficus/badge.svg?branch=master)](https://coveralls.io/github/iheartradio/ficus?branch=master)
[![Latest version](https://index.scala-lang.org/iheartradio/ficus/ficus/latest.svg?color=orange)](https://index.scala-lang.org/iheartradio/ficus)

# Examples #
```scala
import net.ceedubs.ficus.Ficus._

object Country extends Enumeration {
val DE = Value("DE")
val IT = Value("IT")
val NL = Value("NL")
val US = Value("US")
val GB = Value("GB")
}

case class SomeCaseClass(foo: String, bar: Int, baz: Option[FiniteDuration])

class Examples {
Expand All @@ -37,6 +39,12 @@ class Examples {
// something such as "15 minutes" can be converted to a FiniteDuration
val retryInterval: FiniteDuration = config.as[FiniteDuration]("retryInterval")

// can extract arbitrary Enumeration types
// Note: it throws an exception at runtime, if the enumeration type cannot be instantiated or
// if a config value cannot be mapped to the enumeration value
import net.ceedubs.ficus.readers.EnumerationReader._
val someEnumerationType: Seq[Country.Value] = config.as[Seq[Country.Value]]("countries")

// can hydrate most arbitrary types
// it first tries to use an apply method on the companion object and falls back to the primary constructor
// if values are not in the config, they will fall back to the default value on the class/apply method
Expand All @@ -48,24 +56,26 @@ class Examples {
For more detailed examples and how they match up with what's defined in a config file, see [the example spec](https://github.com/ceedubs/ficus/blob/master/src/test/scala/net/ceedubs/ficus/ExampleSpec.scala).

# Adding the dependency #
You most likely already have the Sonatype OSS Releases repository defined in your build, but if you don't, add this to your SBT build file (most likely build.sbt or project/build.scala):
```scala
resolvers ++= Seq(
"Sonatype OSS Releases" at "http://oss.sonatype.org/content/repositories/releases/",
)
```


Now add the Ficus dependency to your build SBT file as well:
```scala
// for Scala 2.10.x
libraryDependencies += "net.ceedubs" %% "ficus" % "1.0.1"
libraryDependencies += "com.iheart" %% "ficus" % "1.0.2"

// for Scala 2.11.x and Java 7
libraryDependencies += "com.iheart" %% "ficus" % "1.1.3"

// for Scala 2.11.x
libraryDependencies += "net.ceedubs" %% "ficus" % "1.1.2"
// for Scala 2.11.x, 2.12.x and Java 8
// See the latest version in the download badge below.
libraryDependencies += "com.iheart" %% "ficus" % <latest version> //see latest version in the badge below
```

[![Latest version](https://index.scala-lang.org/iheartradio/ficus/ficus/latest.svg?color=orange)](https://index.scala-lang.org/iheartradio/ficus)

If you want to take advantage of Ficus's ability to automatically hydrate arbitrary traits and classes from configuration, you need to be on Scala version 2.10.2 or higer, because this functionality depends on implicit macros.

Release notes are available on the [Ficus wiki](https://github.com/ceedubs/ficus/wiki).


# Built-in readers #
Out of the box, Ficus can read most types from config:
Expand All @@ -75,25 +85,53 @@ Out of the box, Ficus can read most types from config:
* Collections (`List[A]`, `Set[A]`, `Map[String, A]`, `Array[A]`, etc. All types with a CanBuildFrom instance are supported)
* `Config` and `ConfigValue` (Typesafe config/value)
* `FiniteDuration`
* The Scala `Enumeration` type. See [Enumeration support](#enumeration-support)
* Most arbitrary classes (as well as traits that have an apply method for instantiation). See [Arbitrary type support](#arbitrary-type-support)

In this context, `A` means any type for which a `ValueReader` is already defined. For example, `Option[String]` is supported out of the box because `String` is. If you want to be able to extract an `Option[Foo[A]]` for some some type `Foo` that doesn't meet the supported type requirements (for example, this `Foo` has a type parameter), the option part is taken care of, but you will need to provide the implementation for extracting a `Foo[A]` from config. See [Custom extraction](#custom-extraction).

# Imports #
The easiest way to start using Ficus config is to just `import net.ceedubs.ficus.Ficus._` as was done in the Examples section. This will import all of the implicit values you need to start easily grabbing most basic types out of config using the `as` method that will become available on Typesafe `Config` objects.

To enable Ficus's reading of `Enumeration` types, you can also import `net.ceedubs.ficus.readers.EnumerationReader._`. See [Enumeration support](#enumeration-support)

To enable Ficus's macro-based reading of case classes and other types, you can also import `net.ceedubs.ficus.readers.ArbitraryTypeReader._`. See [Arbitrary type support](#arbitrary-type-support)

If you would like to be more judicial about what you import (either to prevent namespace pollution or to potentially speed up compile times), you are free to specify which imports you need.

You will probably want to `import net.ceedubs.ficus.Ficus.toFicusConfig`, which will provide an implicit conversion from Typesafe `Config` to `FicusConfig`, giving you the `as` method.

You will then need a [ValueReader](https://github.com/ceedubs/ficus/blob/master/src/main/scala/net/ceedubs/ficus/readers/ValueReader.scala) for each type that you want to grab using `as`. You can choose whether you would like to get the reader via an import or a mixin Trait. For example, if you want to be able to call `as[String]`, you can either `import net.ceedubs.ficus.FicusConfig.stringValueReader` or you can add `with net.ceedubs.ficus.readers.StringReader` to your class definition.
You will then need a [ValueReader](https://github.com/iheartradio/ficus/blob/master/src/main/scala/net/ceedubs/ficus/readers/ValueReader.scala) for each type that you want to grab using `as`. You can choose whether you would like to get the reader via an import or a mixin Trait. For example, if you want to be able to call `as[String]`, you can either `import net.ceedubs.ficus.FicusConfig.stringValueReader` or you can add `with net.ceedubs.ficus.readers.StringReader` to your class definition.

If instead you want to be able to call `as[Option[String]]`, you would need to bring an implicit `ValueReader` for `Option` into scope (via `import net.ceedubs.ficus.FicusConfig.optionValueReader` for example), but then you would also need to bring the `String` value reader into scope as described above, since the `Option` value reader delegates through to the relevant value reader after checking that a config value exists at the given path.

_Don't worry_. It will be obvious if you forgot to bring the right value reader into scope, because the compiler will give you an error.

# Enumeration support #
Ficus has the ability to parse config values to Scala's `Enumeration` type.

If you have the following enum:
```scala
object Country extends Enumeration {
val DE = Value("DE")
val IT = Value("IT")
val NL = Value("NL")
val US = Value("US")
val GB = Value("GB")
}
```

You can define the config like:
```
countries = [DE, US, GB]
```

To get an `Enumeration` type from your config you must import the `EnumerationReader` into your code. Then you can fetch it with the `as` method that Ficus provides on Typesafe `Config` objects.
```scala
import net.ceedubs.ficus.readers.EnumerationReader._
val countries: Seq[Country.Value] = config.as[Seq[Country.Value]]("countries")
```

# Arbitrary type support #

## Supported types ##
Expand All @@ -107,13 +145,25 @@ If it exists, a valid apply method will be used instead of a constructor.

If Ficus doesn't know how to read an arbitrary type, it will provide a helpful **compile-time** error message explaining why. It won't risk guessing incorrectly.

Arbitrary type support requires Scala 2.10.2 or higher, because it takes advantage of implicit macros. To enable it, import `net.ceedubs.ficus.readers.ArbitraryTypeReader._`. Note that having the arbitrary type reader in scope can cause some implicit shadowing that you might not expect. If you define `MyClass` and define an `implicit val myClassReader: ValueReader[MyClass]` in the `MyClass` companion object, the arbitray type reader will still win the implicit prioritization battle unless you specifically `import MyClass.myClassReader`.
Arbitrary type support requires Scala 2.10.2 or higher, because it takes advantage of implicit macros. To enable it, import `net.ceedubs.ficus.readers.ArbitraryTypeReader._`. Note that having the arbitrary type reader in scope can cause some implicit shadowing that you might not expect. If you define `MyClass` and define an `implicit val myClassReader: ValueReader[MyClass]` in the `MyClass` companion object, the arbitrary type reader will still win the implicit prioritization battle unless you specifically `import MyClass.myClassReader`.

By default the config keys has to match exactly the field name in the class, which by java convention is camel cased. To enable hyphen cased mapping, i.e. hyphen cased config keys, you can import a hyphen cased name mapper into the scope, such as:

```scala
import net.ceedubs.ficus.readers.namemappers.implicits.hyphenCase
```

# Custom extraction #
When you call `as[String]("somePath")`, Ficus config knows how to extract a String because there is an implicit `ValueReader[String]` in scope. If you would like, you can even teach it how to extract a `Foo` from the config using `as[Foo]("fooPath")` if you create your own `ValueReader[Foo]`. You could pass this Foo extractor explicitly to the `as` method, but most likely you just want to make it implicit. For an example of a custom value reader, see the `ValueReader[ServiceConfig]` defined in [ExampleSpec](https://github.com/ceedubs/ficus/blob/master/src/test/scala/net/ceedubs/ficus/ExampleSpec.scala).

# Contributions #

Many thanks to all of [those who have contributed](https://github.com/ceedubs/ficus/blob/master/CONTRIBUTORS.md) to Ficus.
Many thanks to all of [those who have contributed](https://github.com/iheartradio/ficus/blob/master/CONTRIBUTORS.md) to Ficus.

Would you like to contribute to Ficus? Pull requests are welcome and encouraged! Please note that contributions will be under the [MIT license](https://github.com/iheartradio/ficus/blob/master/LICENSE). Please provide unit tests along with code contributions.



## Binary Compatibility

Would you like to contribute to Ficus? Pull requests are welcome and encouraged! Please note that contributions will be under the [MIT license](https://github.com/ceedubs/ficus/blob/master/LICENSE). Please provide unit tests along with code contributions.
[MiMa](https://github.com/typesafehub/migration-manager) can be used to check the binary compatibility between two versions of a library.T To check for binary incompatibilities, run `mimaReportBinaryIssues` in the sbt repl. The build is configured to compare the current version against the last released version (It does this naïvely at the moment by merely decrementing bugfix version). If any binary compatibility issues are detected, you may wish to adjust your code to maintain binary compatibility, if that is the goal, or modify the minor version to indicate to consumers that the new version should not be considered binary compatible.
117 changes: 43 additions & 74 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,73 +1,53 @@
import sbtrelease.Version

/* basic project info */
name := "ficus"

organization := "net.ceedubs"

description := "A Scala-friendly wrapper companion for Typesafe config"

homepage := Some(url("https://github.com/ceedubs/ficus"))

startYear := Some(2013)

licenses := Seq(
"MIT License" -> url("http://www.opensource.org/licenses/mit-license.html")
)

scmInfo := Some(
ScmInfo(
url("https://github.com/ceedubs/ficus"),
"scm:git:https://github.com/ceedubs/ficus.git",
Some("scm:git:[email protected]:ceedubs/ficus.git")
)
)

/* scala versions and options */
scalaVersion := "2.11.0"
scalaVersion := "2.12.0"

crossScalaVersions := Seq(scalaVersion.value, "2.10.6", "2.11.8")

// These options will be used for *all* versions.
scalacOptions ++= Seq(
"-feature",
"-deprecation",
"-unchecked",
"-encoding", "UTF-8"
)
"-encoding", "UTF-8",
"-target:jvm-1." + {
CrossVersion.partialVersion(scalaVersion.value).collect {
case (2, minor) if minor <= 10 => "7"
}.getOrElse("8")
}
) ++ (if (scalaVersion.value.startsWith("2.11") || scalaVersion.value.startsWith("2.10")) Seq("-Yclosure-elim", "-Yinline") else Seq.empty[String])

scalacOptions ++= Seq(
"-Yclosure-elim",
"-Yinline"
javacOptions ++= Seq(
"-Xlint:unchecked", "-Xlint:deprecation"
)

// These language flags will be used only for 2.10.x.
// Uncomment those you need, or if you hate SIP-18, all of them.
scalacOptions <++= scalaVersion map { sv =>
if (sv startsWith "2.10") List(
"-Xverify",
"-Ywarn-all",
"-feature",
"-language:postfixOps",
"-language:implicitConversions",
"-language:higherKinds"
)
else Nil
}

javacOptions ++= Seq("-Xlint:unchecked", "-Xlint:deprecation")

/* dependencies */
libraryDependencies <++= scalaVersion { sv =>
Seq(
"org.specs2" %% "specs2" % "2.3.11" % "test",
"org.scalacheck" %% "scalacheck" % "1.11.3" % "test",
"com.chuusai" %% "shapeless" % "2.0.0" % "test",
"com.typesafe" % "config" % "1.2.1",
"org.scala-lang" % "scala-reflect" % sv % "provided")
}
libraryDependencies ++= Seq(
"org.specs2" %% "specs2-core" % "3.8.6" % "test",
"org.specs2" %% "specs2-scalacheck" % "3.8.6" % "test",
"org.scalacheck" %% "scalacheck" % "1.13.4" % "test",
"com.chuusai" %% "shapeless" % "2.3.2" % "test",
"com.typesafe" % "config" % "1.3.1",
"org.scala-lang" % "scala-reflect" % scalaVersion.value % "provided",
"org.scala-lang" % "scala-compiler" % scalaVersion.value % "provided",
"org.typelevel" %% "macro-compat" % "1.1.1",
compilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)
)

/* you may need these repos */
resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots")
Resolver.sonatypeRepo("snapshots"),
Resolver.bintrayRepo("iheartradio","maven"),
Resolver.jcenterRepo
)

/* testing */
parallelExecution in Test := true

/* sbt behavior */
Expand All @@ -77,33 +57,22 @@ traceLevel := 5

offline := false

/* publishing */
publishMavenStyle := true

publishTo <<= version { (v: String) =>
val nexus = "https://oss.sonatype.org/"
if (v.trim.endsWith("SNAPSHOT")) Some(
"snapshots" at nexus + "content/repositories/snapshots"
)
else Some("releases" at nexus + "service/local/staging/deploy/maven2")
}

mappings in (Compile, packageBin) ~= { (ms: Seq[(File, String)]) =>
ms filter { case (file, toPath) =>
toPath != "application.conf"
mappings in (Compile, packageBin) := {
val ms = mappings.in(Compile, packageBin).value
ms filter { case (_, toPath) =>
toPath != "application.conf"
}
}

publishArtifact in Test := false
Publish.settings

pomIncludeRepository := { _ => false }
releaseCrossBuild := true

mimaPreviousArtifacts := (if (scalaBinaryVersion.value != "2.10") {
Version(version.value).map {
case Version(major, subversions, _) =>
val (minor :: bugfix :: _) = subversions.toList
Set(organization.value %% name.value % Seq(major, minor, bugfix - 1).mkString("."))
}.getOrElse(Set.empty)
} else Set.empty)

pomExtra := (
<developers>
<developer>
<id>ceedubs</id>
<name>Cody Allen</name>
<email>[email protected]</email>
</developer>
</developers>
)
Loading