Skip to content

Commit

Permalink
docs: add README instructions to run
Browse files Browse the repository at this point in the history
  • Loading branch information
tassiluca committed Mar 4, 2024
1 parent 53c376e commit 30e9132
Show file tree
Hide file tree
Showing 16 changed files with 145 additions and 14 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,20 @@ direct-style-experiments
└── smart-hub-direct-kt # smart hub example using Kotlin Coroutines
```

**IMPORTANT NOTE: Examples works with a version of the JDK > 21** (Virtual Threads are needed!).

To build and run all the tests:

```
./gradlew build
```

Generally speaking, the runnable examples can be run by simply executing the `run` Gradle task in the respective submodule, like:

```bash
```
./gradlew :analyzer-direct:run
```

Detailed instructions follows in the specific sections (and in `README`).
Detailed instructions can be found in the `README` file of the submodule and in the [documentation](https://tassiluca.github.io/direct-style-experiments/).

**Examples works with a version of the JDK > 21** (Virtual Threads are needed!).
The documentation can be found [here](https://tassiluca.github.io/direct-style-experiments/).
19 changes: 19 additions & 0 deletions analyzer-direct-kt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Analyzer example - Kotlin Coroutines version

To run the example:

```
./gradlew :analyzer-direct-kt:run
```

In order to run the application you need to place inside the `analyzer-commons` directory a `.env` file containing [your personal GitHub access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens), like:

```env
GH_TOKEN=....
```

or having set an environment variable named `GH_TOKEN`.

![Analyzer example](../docs/content/res/img/analyzer-e2e.png)

Have a look to [the documentation](https://tassiluca.github.io/direct-style-experiments/docs/03-channels/) for more details.
19 changes: 19 additions & 0 deletions analyzer-direct/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Analyzer example - Scala Gears version

To run the example:

```
./gradlew :analyzer-direct:run
```

In order to run the application you need to place inside the `analyzer-commons` directory a `.env` file containing [your personal GitHub access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens), like:

```env
GH_TOKEN=....
```

or having set an environment variable named `GH_TOKEN`.

![Analyzer example](../docs/content/res/img/analyzer-e2e.png)

Have a look to [the documentation](https://tassiluca.github.io/direct-style-experiments/docs/03-channels/) for more details.
21 changes: 21 additions & 0 deletions analyzer-monadic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Analyzer example - monadic `Future` version

To run the example:

```
./gradlew :analyzer-direct:run
```

In order to run the application you need to place inside the `analyzer-commons` directory a `.env` file containing [your personal GitHub access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens), like:

```env
GH_TOKEN=....
```

or having set an environment variable named `GH_TOKEN`.

![Analyzer example](../docs/content/res/img/analyzer-e2e.png)

Warning: Incremental retrieval of results from the github api using pagination has not been implemented for this version (the data displayed may therefore be partial)

Have a look to [the documentation](https://tassiluca.github.io/direct-style-experiments/docs/03-channels/) for more details.
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ object RepositoryService:
private val request = basicRequest.auth.bearer(System.getenv("GH_TOKEN"))

override def repositoriesOf(organizationName: String): EitherT[Task, String, Seq[Repository]] =
performRequest[Seq[Repository]](uri"$apiUrl/orgs/$organizationName/repos")
performRequest[Seq[Repository]](uri"$apiUrl/orgs/$organizationName/repos?per_page=100")

override def contributorsOf(
organizationName: String,
repositoryName: String,
): EitherT[Task, String, Seq[Contribution]] =
performRequest[Seq[Contribution]](uri"$apiUrl/repos/$organizationName/$repositoryName/contributors")
performRequest[Seq[Contribution]](uri"$apiUrl/repos/$organizationName/$repositoryName/contributors?per_page=100")

override def lastReleaseOf(
organizationName: String,
Expand Down
10 changes: 10 additions & 0 deletions blog-ws-direct-kt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Blog web service - Kotlin Coroutine version

For this example just the tests are provided. You can explore them in the `test` folder.
To execute the tests, run:

```
./gradlew :blog-ws-direct-kt:test
```

Have a look to [the documentation](https://tassiluca.github.io/direct-style-experiments/docs/02-basics/) for more details.
10 changes: 10 additions & 0 deletions blog-ws-direct/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Blog web service - Scala Gears version

For this example just the tests are provided. You can explore them in the `test` folder.
To execute the tests, run:

```
./gradlew :blog-ws-direct:test
```

Have a look to [the documentation](https://tassiluca.github.io/direct-style-experiments/docs/02-basics/) for more details.
10 changes: 10 additions & 0 deletions blog-ws-monadic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Blog web service - monadic `Future` version

For this example just the tests are provided. You can explore them in the `test` folder.
To execute the tests, run:

```
./gradlew :blog-ws-monadic:test
```

Have a look to [the documentation](https://tassiluca.github.io/direct-style-experiments/docs/02-basics/) for more details.
14 changes: 10 additions & 4 deletions docs/content/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,18 @@ direct-style-experiments
└── smart-hub-direct-kt # smart hub example using Kotlin Coroutines
```

**IMPORTANT NOTE: Examples works with a version of the JDK > 21** (Virtual Threads are needed!).

To build and run all the tests:

```
./gradlew build
```

Generally speaking, the runnable examples can be run by simply executing the `run` Gradle task in the respective submodule, like:

```bash
```
./gradlew :analyzer-direct:run
```

Detailed instructions follows in the specific sections (and in `README`).

**Examples works with a version of the JDK > 21** (Virtual Threads are needed!).
Detailed instructions can be found in the `README` file of each submodule and in the [documentation](https://tassiluca.github.io/direct-style-experiments/).
2 changes: 1 addition & 1 deletion docs/content/docs/03-channels.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ To start the application:

{{< hint warning >}}

In order to use the application you need to place inside the `analyzer-commons` module a `.env` file containing [your personal GitHub access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens), like:
In order to run the application you need to place inside the `analyzer-commons` directory a `.env` file containing [your personal GitHub access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens), like:

```env
GH_TOKEN=....
Expand Down
2 changes: 1 addition & 1 deletion docs/content/docs/04-rears.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ The example is runnable via:
```

Three panels should pop up, one for each sensor type, and a dashboard showing the state of the system.
Entering some value in the panels and pressing the "Send" button, after 5 seconds (the configured sampling window), the system should react to the data received, updating the dashboard with the new state.
Entering some value in the panels and pressing the "Send" button, after 10 seconds (the configured sampling window), the system should react to the data received, updating the dashboard with the new state.

{{< figure src="../../res/img/smart-hub.png" alt="Smart Hub application" width="90%" >}}

Expand Down
14 changes: 14 additions & 0 deletions smart-hub-direct-kt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Smart hub example - Kotlin Coroutines version

To run the example:

```
./gradlew :smart-hub-direct-kt:run
```

Three panels should pop up, one for each sensor type, and a dashboard showing the state of the system.
Entering some value in the panels and pressing the "Send" button, after 10 seconds (the configured sampling window), the system should react to the data received, updating the dashboard with the new state.

![Smart hub example](../docs/content/res/img/smart-hub.png)

Have a look to [the documentation](https://tassiluca.github.io/direct-style-experiments/docs/04-rears/) for more details.
14 changes: 14 additions & 0 deletions smart-hub-direct/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Smart hub example - Scala Gears version

To run the example:

```
./gradlew :smart-hub-direct:run
```

Three panels should pop up, one for each sensor type, and a dashboard showing the state of the system.
Entering some value in the panels and pressing the "Send" button, after 10 seconds (the configured sampling window), the system should react to the data received, updating the dashboard with the new state.

![Smart hub example](../docs/content/res/img/smart-hub.png)

Have a look to [the documentation](https://tassiluca.github.io/direct-style-experiments/docs/04-rears/) for more details.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import scala.language.postfixOps
/** The hub managing the lighting system. */
trait LightingManager extends LightingSystemComponent with LampsComponent with DashboardServiceComponent:
override val lightingSystem: LightingSystem = LightingSystem()
private val samplingWindow = 5 seconds
private val samplingWindow = 10 seconds

/** Runs the manager, spawning a new controller consuming the given [[source]] of events. */
def run(source: ReadableChannel[LuminosityEntry])(using Async, AsyncOperations): Unit =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ trait ThermostatManager
with DashboardServiceComponent:
override val thermostat: Thermostat = Thermostat(ThermostatScheduler.byHour(19))
override val sensorHealthChecker: SensorHealthChecker = SensorHealthChecker()
private val samplingWindow = 5 seconds
private val samplingWindow = 10 seconds

/** Runs the manager, spawning a new controller consuming the given [[source]] of events. */
def run(source: ReadableChannel[TemperatureEntry])(using Async, AsyncOperations): Unit =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import io.github.tassiLuca.hub.core.{Luminosity, Temperature}

import scala.concurrent.duration.DurationInt

val samplingWindow = 5.seconds
val samplingWindow = 10.seconds

enum Message:
case HeaterOn, HeaterOff, Alert, HeaterGetState, TemperatureUpdate, LuminosityUpdate, LightingOff, LightingOn
Expand Down

0 comments on commit 30e9132

Please sign in to comment.