diff --git a/core/src/main/scala/com/geirolz/app/toolkit/AppBuilder.scala b/core/src/main/scala/com/geirolz/app/toolkit/AppBuilder.scala index 7392645..f5e1518 100644 --- a/core/src/main/scala/com/geirolz/app/toolkit/AppBuilder.scala +++ b/core/src/main/scala/com/geirolz/app/toolkit/AppBuilder.scala @@ -15,7 +15,7 @@ import com.geirolz.app.toolkit.novalues.{NoConfig, NoDependencies, NoFailure, No import java.time.LocalDateTime import scala.reflect.Typeable -final class AppBuilder[F[+_]: Async: Parallel, FAILURE <: Matchable]: +final class AppBuilder[F[+_]: Async: Parallel, FAILURE <: Matchable: Typeable]: inline def withInfo( name: String = "", @@ -52,12 +52,12 @@ object AppBuilder: inline def simple[F[+_]: Async: Parallel]: AppBuilder.Simple[F] = new AppBuilder[F, NoFailure] - inline def withFailure[F[+_]: Async: Parallel, FAILURE <: Matchable: NotNoFailure]: AppBuilder[F, FAILURE] = + inline def withFailure[F[+_]: Async: Parallel, FAILURE <: Matchable: NotNoFailure: Typeable]: AppBuilder[F, FAILURE] = new AppBuilder[F, FAILURE] final class SelectResAndDeps[ F[+_]: Async: Parallel, - FAILURE <: Matchable, + FAILURE <: Matchable: Typeable, INFO <: SimpleAppInfo[?], LOGGER_T[_[_]]: LoggerAdapter, CONFIG: Show, @@ -131,7 +131,7 @@ object AppBuilder: dependsOn[NoDependencies, FAILURE](Resource.pure(NoDependencies.value)) /** Dependencies are loaded into context and released at the end of the application. */ - inline def dependsOn[DEPENDENCIES <: Matchable: Typeable, FAILURE2 <: FAILURE & Matchable: Typeable]( + inline def dependsOn[DEPENDENCIES <: Matchable, FAILURE2 <: FAILURE & Matchable]( f: AppContext.NoDeps[INFO, LOGGER_T[F], CONFIG, RESOURCES] ?=> Resource[F, FAILURE2 | DEPENDENCIES] ): AppBuilder.SelectProvide[F, FAILURE, INFO, LOGGER_T, CONFIG, RESOURCES, DEPENDENCIES] = dependsOnE[DEPENDENCIES, FAILURE2](f.map { @@ -155,7 +155,7 @@ object AppBuilder: private def copyWith[ G[+_]: Async: Parallel, - FAILURE2 <: Matchable, + FAILURE2 <: Matchable: Typeable, INFO2 <: SimpleAppInfo[?], LOGGER_T2[_[_]]: LoggerAdapter, CONFIG2: Show, diff --git a/core/src/test/scala/com/geirolz/app/toolkit/AppContextAndDependenciesSuite.scala b/core/src/test/scala/com/geirolz/app/toolkit/AppContextAndDependenciesSuite.scala index 20d47ab..b3f30d0 100644 --- a/core/src/test/scala/com/geirolz/app/toolkit/AppContextAndDependenciesSuite.scala +++ b/core/src/test/scala/com/geirolz/app/toolkit/AppContextAndDependenciesSuite.scala @@ -1,14 +1,13 @@ package com.geirolz.app.toolkit import cats.effect.{IO, Resource} -import com.geirolz.app.toolkit.logger.Logger import com.geirolz.app.toolkit.testing.{TestAppInfo, TestConfig} class AppContextAndDependenciesSuite extends munit.FunSuite: // false positive not exhaustive pattern matching ? TODO: investigate test("AppContext unapply works as expected") { - val res = App[IO] + App[IO] .withInfo(TestAppInfo.value) .withConsoleLogger() .withConfigPure(TestConfig.defaultTest) diff --git a/docs/compiled/README.md b/docs/compiled/README.md index 8f028ad..65acaf8 100644 --- a/docs/compiled/README.md +++ b/docs/compiled/README.md @@ -61,7 +61,7 @@ To get started with Toolkit, follow these steps: installation instructions in the [Toolkit GitHub repository](https://github.com/geirolz/toolkit). ```sbt -libraryDependencies += "com.github.geirolz" %% "toolkit" % "0.0.11" +libraryDependencies += "com.github.geirolz" %% "toolkit" % "0.1.0-RC3" ``` 2. **Define Your Application:** Create a new Scala objects or classes that represents your application dependencies and @@ -110,6 +110,7 @@ object KafkaConsumer: import cats.effect.{ExitCode, IO, IOApp} import com.geirolz.app.toolkit.* import com.geirolz.app.toolkit.logger.Logger +import java.time.LocalDateTime object Main extends IOApp: override def run(args: List[String]): IO[ExitCode] = @@ -119,11 +120,12 @@ object Main extends IOApp: name = "toolkit", version = "0.0.1", scalaVersion = "2.13.10", - sbtVersion = "1.8.0" + sbtVersion = "1.8.0", + builtOn = LocalDateTime.now() ) ) .withConsoleLogger() - .withConfigF(IO.pure(Config("localhost", 8080))) + .withConfig(IO.pure(Config("localhost", 8080))) .dependsOn(AppDependencyServices.resource) .beforeProviding(ctx.logger.info("CUSTOM PRE-PROVIDING")) .provideOne( diff --git a/docs/compiled/integrations.md b/docs/compiled/integrations.md index 79050a0..02f41e8 100644 --- a/docs/compiled/integrations.md +++ b/docs/compiled/integrations.md @@ -34,7 +34,7 @@ and YAML. Include this module in your project by adding the following dependency: ```sbt -libraryDependencies += "com.github.geirolz" %% "toolkit-pureconfig" % "0.0.11" +libraryDependencies += "com.github.geirolz" %% "toolkit-pureconfig" % "0.1.0-RC3" ``` Import the integration module in your application: @@ -51,6 +51,7 @@ import cats.Show import cats.effect.IO import com.geirolz.app.toolkit.{App, SimpleAppInfo} import com.geirolz.app.toolkit.config.pureconfig.* +import java.time.LocalDateTime case class TestConfig(value: String) @@ -66,10 +67,11 @@ App[IO] name = "toolkit", version = "0.0.1", scalaVersion = "2.13.10", - sbtVersion = "1.8.0" + sbtVersion = "1.8.0", + builtOn = LocalDateTime.now() ) ) - .withConfigF(pureconfigLoader[IO, TestConfig]) + .withConfig(pureconfigLoader[IO, TestConfig]) .withoutDependencies .provideOne(IO.unit) .run() @@ -94,7 +96,7 @@ configuration options to suit your needs. Include this module in your project by adding the following dependency: ```sbt -libraryDependencies += "com.github.geirolz" %% "toolkit-log4cats" % "0.0.11" +libraryDependencies += "com.github.geirolz" %% "toolkit-log4cats" % "0.1.0-RC3" ``` And just use the `withLogger` method to configure the logger. @@ -116,7 +118,7 @@ Odin provides flexible configuration options to meet your logging requirements. Include this module in your project by adding the following dependency: ```sbt -libraryDependencies += "com.github.geirolz" %% "toolkit-odin" % "0.0.11" +libraryDependencies += "com.github.geirolz" %% "toolkit-odin" % "0.1.0-RC3" ``` And just use the `withLogger` method to configure the logger. @@ -137,7 +139,7 @@ ensuring that your application operates with the correct database schema. Import this module in your project by adding the following dependency: ```sbt -libraryDependencies += "com.github.geirolz" %% "toolkit-fly4s" % "0.0.11" +libraryDependencies += "com.github.geirolz" %% "toolkit-fly4s" % "0.1.0-RC3" ``` Import the tasks @@ -157,6 +159,7 @@ import cats.Show import cats.effect.IO import com.geirolz.app.toolkit.fly4s.* import com.geirolz.app.toolkit.* +import java.time.LocalDateTime case class TestConfig(dbUrl: String, dbUser: Option[String], dbPassword: Option[Array[Char]]) @@ -169,7 +172,8 @@ App[IO] name = "toolkit", version = "0.0.1", scalaVersion = "2.13.10", - sbtVersion = "1.8.0" + sbtVersion = "1.8.0", + builtOn = LocalDateTime.now() ) ) .withConfigPure(