Skip to content

Commit

Permalink
Version 1.1.0-SNAPSHOT
Browse files Browse the repository at this point in the history
- Refactored the `configz` module
- Added a few more implicits to the `core` module
  • Loading branch information
tupol committed Oct 18, 2021
1 parent 48d1bd5 commit fa46e43
Show file tree
Hide file tree
Showing 33 changed files with 375 additions and 215 deletions.
21 changes: 12 additions & 9 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
version = "2.1.0"
version = "2.6.3"
maxColumn = 120
align = most
continuationIndent.defnSite = 2
align.preset = most
align.multiline = true
assumeStandardLibraryStripMargin = true
docstrings = JavaDoc
lineEndings = preserve
includeCurlyBraceInSelectChains = false
danglingParentheses = true
spaces {
inImportCurlyBraces = true
}
includeCurlyBraceInSelectChains = true
includeNoParensInSelectChains = false
danglingParentheses.callSite = false
danglingParentheses.defnSite = false
spaces.inImportCurlyBraces = true
optIn.annotationNewlines = true

optIn.breakChainOnFirstMethodDot = true
optIn.encloseClassicChains = true
optIn.forceBlankLineBeforeDocstring = true
binPack.literalArgumentLists = true
rewrite.rules = [SortImports, RedundantBraces]
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ where the latest artifacts can be found.
Usage with SBT, adding a dependency to the latest version of scala utils to your sbt build definition file:

```scala
libraryDependencies += "org.tupol" %% "scala-utils-core" % "1.0.0-RC02"
libraryDependencies += "org.tupol" %% "scala-utils-core" % "1.0.0"
```
or
```scala
libraryDependencies += "org.tupol" %% "scala-utils-core" % "1.0.0-RC02"
libraryDependencies += "org.tupol" %% "scala-utils-core" % "1.0.0"
```

For Snapshots, the Sonatype snapshots repo needs to be added as well:
Expand All @@ -56,11 +56,16 @@ Some `config-z` usage examples can be found under [`config-z/src/test/scala/exam

## What's new?

**1.0.0-RC** Effort Started
**1.1.0-SNAPSHOT**
- Refactored the `configz` module
- Added a few more utility implicits to the `core` module


**1.0.0**

This new major version aims to bring a new and hopefully cleaner project structure.
The `scalaz` based configuration is moved to a different module to isolate better from the core.
In the future a `cats` based version will be added as well.
In the future a `cats` based version might be added as well.

More core utilities were added and the old ones were brushed up for better consistency and clarity.

Expand Down
9 changes: 7 additions & 2 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
# Release Notes

## 1.0.0

- Added the Collections `toOptionNel` utility
- Further refactoring of the `config-z` module


## 1.0.0-RC02

- Minor project refactoring and cleanup
- Added `Future.allOkOrFail`

-

## 1.0.0-RC01

- Major project refactoring and cleanup
Expand Down
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ lazy val coverageSettings = Seq(
coverageFailOnMinimum in Test := true,
coverageExcludedPackages := ".*BuildInfo.*"
)

lazy val basicSettings = Seq(
organization := "org.tupol",
name := "scala-utils",
Expand Down
19 changes: 9 additions & 10 deletions config-z/docs/configuration-framework.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Configuration Framework

## Deprecated
[[_TOC_]]

***Attention!***

The *Configuration framework* is deprecated, as the
[PureConfig](https://pureconfig.github.io/) framework is much more mature and provides a better
The *Configuration framework* is deprecated, as other frameworks, like
[PureConfig](https://pureconfig.github.io/), are more mature and provides a better
overall solution.

## Scope
Expand All @@ -19,10 +19,10 @@ The configuration framework is based on *ScalaZ* `validation` infrastructure.

The main reason for using the *ScalaZ* `ValidationNel` is to be able to collect all error messages found during the
configuration of the target object, and showing them to the user in one go, rather than one by one, as each problem is
fixed, application is ran again and the next problem is revealed.
fixed, application is run again and the next problem is revealed.

The key concepts are:
- `org.tupol.utils.Configurator`
- `org.tupol.configz.Configurator`
- `scalaz.ValidationNel`; for more details look [here](https://github.com/scalaz/scalaz/blob/series/7.2.x/core/src/main/scala/scalaz/Validation.scala)
- `com.typesafe.config.Config`; for more details look [here](https://github.com/typesafehub/config)

Expand All @@ -41,7 +41,6 @@ The `Configurator` is used as a factory for case classes starting from a Typesaf
The type parameter `T` is the type of the class instance we are constructing.



## Usage

In order to create a new configuration we need the following:
Expand Down Expand Up @@ -73,7 +72,7 @@ case class MySimpleExample(path: String, overwrite: Boolean) {
#### 2. Create a corresponding `Configurator` and implement the `validationNel()` function

```scala
import org.tupol.scala.config.Configurator
import org.tupol.configz.Configurator

object MySimpleExample extends Configurator[MySimpleExample] {

Expand All @@ -96,7 +95,7 @@ object MySimpleExample extends Configurator[MySimpleExample] {

1. Normally we define the configurator factory in a companion object attached to the case class that we want to configure.

2. The only top level import is `import org.tupol.utils.configz.Configurator`.
2. The only top level import is `import org.tupol.configz.Configurator`.
We are quite keen on keeping the top level imports clean, and only import locally what we need.
The subsequent sets of imports are inside the `MySimpleExample` object scope and in the `validationNel` function scope.

Expand Down Expand Up @@ -159,7 +158,7 @@ case class MyComplexExample(example: MySimpleExample, separatorChar: String, sep
#### 2. Create a corresponding `Configurator` and implement the `validationNel()` function

```scala
import org.tupol.scala.config.Configurator
import org.tupol.configz.Configurator

object MyComplexExample extends Configurator[MyComplexExample] {

Expand Down Expand Up @@ -188,7 +187,7 @@ written more elegantly like the following:


```scala
import org.tupol.scala.config.Configurator
import org.tupol.configz.Configurator

implicit val mySimpleExampleExtractor = MySimpleExample

Expand Down
Loading

0 comments on commit fa46e43

Please sign in to comment.