Skip to content

Commit

Permalink
Fix compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
geirolz committed Sep 18, 2024
1 parent 2e21c34 commit 502257d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 17 deletions.
10 changes: 5 additions & 5 deletions core/src/main/scala/com/geirolz/app/toolkit/AppBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand All @@ -155,7 +155,7 @@ object AppBuilder:

private def copyWith[
G[+_]: Async: Parallel,
FAILURE2 <: Matchable,
FAILURE2 <: Matchable: Typeable,
INFO2 <: SimpleAppInfo[?],
LOGGER_T2[_[_]]: LoggerAdapter,
CONFIG2: Show,
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
8 changes: 5 additions & 3 deletions docs/compiled/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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] =
Expand All @@ -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(
Expand Down
18 changes: 11 additions & 7 deletions docs/compiled/integrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)

Expand All @@ -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()
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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]])

Expand All @@ -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(
Expand Down

0 comments on commit 502257d

Please sign in to comment.