Recent Releases of com.bkahlert.kommons:kommons
com.bkahlert.kommons:kommons - v2.8.0
[2.8.0] - 2023-03-05
Added
- Uri.resolve / Uri.resolveTo
- Example
kotlin Uri("http://a/b/c/d;p?q").resolve("../g") // returns Uri("http://a/b/g")
- Example
- DataUri factory for textual data
Changed
- upgrade to
- Kotlin 1.8.10
- Ktor 2.2.3
- Kotlinx.serialization to 1.5.0
- moved time-related feature to separate kommons-time module
Fixed
toMomentStringfor negative dates
- Kotlin
Published by github-actions[bot] about 3 years ago
com.bkahlert.kommons:kommons - v2.7.0
Changed
- cleanup dependencies
- change implementation dependency of SLF4J to api dependency
- kommons-uri:
- parse and serialize Uniform Resource Identifiers (RFC3986)
- support for kotlinx.serialization
- support for data URIs (RFC2397) with an appropriate URL stream handler provider registered on the JVM
Fixed
- logger name computation in Firefox
- Kotlin
Published by github-actions[bot] over 3 years ago
com.bkahlert.kommons:kommons - v2.6.0
Added
- Kommons Bill of Materials
- Clock builder
- Clock.fixed
Changed
Upgrade to Kotlin 1.8.0
Kommons Test's dynamic test builders
testing/testingAllnow lazily build tests as they're consumed by JUnit
Fixed
- Add ValueRange.toString
- Kotlin
Published by github-actions[bot] over 3 years ago
com.bkahlert.kommons:kommons - v2.5.0
Added
Kotlin-specific structured logging
```kotlin data class Bar(val bar: Int) { override fun toString(): String = "bar-$bar" }
logger.info("Successfully created {}", array(Bar(1), Bar(2))) ```
json
{
"@timestamp": "2022-12-14T14:51:57.583+01:00",
"level": "INFO",
"message": "Successfully created bars=[bar-1, bar-2]",
"bars": [
{
"bar": 1
},
{
"bar": 2
}
]
}
Changed
- chore: upgrade to Kotlin 1.7.21
- Kotlin
Published by github-actions[bot] over 3 years ago
com.bkahlert.kommons:kommons - v2.4.1
Changed
- chore: upgrade to Gradle 7.6
Fixed
- fix: add back
js.Dateextension functions
- Kotlin
Published by github-actions[bot] over 3 years ago
com.bkahlert.kommons:kommons -
Added
- Native for ...
- Linux x64
- MinGW x64
- macOS x64
- macOS ARM 64
- and the following modules ...
- Kommons Core
- Kommons Kaomoji
- Kommons Test
- Kommons Text
- Kotlin
Published by github-actions[bot] over 3 years ago
com.bkahlert.kommons:kommons - v2.3.1
Fixed
- catch InaccessibleObjectException when attempting to compute PID
- Kotlin
Published by github-actions[bot] over 3 years ago
com.bkahlert.kommons:kommons - v2.3.0
Added
- Kotest JSON assertions API dependency
- CommandLine constructor to invoke the main method of class using Java
- Fix SyncExecutor to always empty and close the output and error stream
- Kotlin
Published by github-actions[bot] over 3 years ago
com.bkahlert.kommons:kommons - v2.2.0
Added
- add Japanese style emoticon constants such as
(つ◕౪◕)つ━☆゚.*・。゚ - add kommons-exec
Removed
- removed
kommons-exec-deprecated
- Kotlin
Published by github-actions[bot] over 3 years ago
com.bkahlert.kommons:kommons - v2.1.0
Added
- simple
pluralize()extension function Kommons Logging: Core: get Logback or Kotlin Logger logger easilyKommons Logging: Logback: configure logging using system propertiesCONSOLE_LOG_PRESETandFILE_LOG_PRESETKommons Logging: Spring Boot: configure logging using application propertieslogging.preset.consoleandlogging.preset.file
Changed
- Set
junit.jupiter.execution.parallel.config.dynamic.factorto 2. - Display "PascalCaseNestedTests" as "pascal case nested tests".
Fixed
- Set JS test timeout to same as JUnit tests.
- Kotlin
Published by github-actions[bot] over 3 years ago
com.bkahlert.kommons:kommons - v2.0.0
Changed
- migrated Kommons 1.x.x to this Gradle multi-project
- migrated Kommons Debug 0.x.x to this Gradle multi-project
- migrated Kommons Test 0.x.x to this Gradle multi-project
- Kotlin
Published by github-actions[bot] almost 4 years ago
com.bkahlert.kommons:kommons - Test release
This is a test release to check if the new workflow works.
- Kotlin
Published by bkahlert over 4 years ago
com.bkahlert.kommons:kommons - v1.6.0 — OpenTelemetry Integration
- Kotlin
Published by bkahlert almost 5 years ago
com.bkahlert.kommons:kommons - Refactored Kaomoji
kotlin
public object Wizards : Category() {
public val `(ノ>ω<)ノ﹕・゚’★,。・﹕*﹕・゚’☆`: Kaomoji by parts("(ノ", ">", "ω", "<", ")ノ", " :。・:*:・゚’★,。・:*:・゚’☆")
public val `(# ̄_ ̄)o︠・━・・━・━━・━☆`: Kaomoji by parts(0..1, 2..2, 3..3, 4..4, 5..7, 8..18)
public val `(/ ̄‿ ̄)/~~☆’․・․・﹕★’․・․・﹕☆`: Kaomoji by parts("(/", " ̄", "‿", " ̄", ")/", "~~☆’.・.・:★’.・.・:☆")
public val `(∩ᄑ_ᄑ)⊃━☆゚*・。*・﹕≡( ε﹕)`: Kaomoji by parts("(∩", "ᄑ", "_", "ᄑ", ")⊃", "━☆゚*・。*・:≡( ε:)")
public val `(ノ ˘_˘)ノ ζζζ ζζζ ζζζ`: Kaomoji by parts(0..2, 3..3, 4..4, 5..5, 6..7, 8..21)
public val `(ノ°∀°)ノ⌒・*﹕․。․ ․。․﹕*・゜゚・*☆`: Kaomoji by parts("(ノ", "°", "∀", "°", ")ノ", "⌒・*:.。. .。.:*・゜゚・*☆")
public val `(⊃。•́‿•̀。)⊃━✿✿✿✿✿✿`: Kaomoji by parts(0..2, 3..4, 5..5, 6..7, 8..10, 11..17)
public val `ଘ(੭ˊᵕˋ)੭* ੈ✩‧₊˚`: Kaomoji by parts(0..2, 3..3, 4..4, 5..5, 6..7, 8..14)
}
- Kotlin
Published by bkahlert about 5 years ago
com.bkahlert.kommons:kommons - Koodies Exec: Feature-Rich Process Execution
What can you run?
⌨️ Command Lines CommandLine("printenv", "HOME").exec()
📄 Shell Scripts ShellScript { "printenv | grep HOME | perl -pe 's/.*?HOME=//'" }.exec()
How can you run?
Degree of Interaction
▶️ executing-only ShellScript { … }.exec()
📝 logging ShellScript { … }.exec.logging()
- If things go wrong, it's also logged:
```text
Process {PID} terminated with exit code {…}
➜ A dump has been written to:
- {WorkDir}/koodies.dump.{}.log
- {WorkDir}/koodies.dump.{}.ansi-removed.log
➜ The last 10 lines are:
{…}
3
2
1
Boom!
```
🧠 processing ShellScript { … }.exec.processing { io -> doSomething(io) }
iois typed; simply useio is IO.Outputto filter out errors and meta information
Synchronicity
👯♀️ 👯♂️ synchronous: ShellScript { … }.exec()
💃 🕺 asynchronous: ShellScript { … }.exec.async()
Where can you run?
💻 Locally ShellScript { … }.exec()
🐳 Dockerized ShellScript { … }.dockerized{ "bkahlert" / "libguestfs" }.exec()
- use any Docker image you like
Features
Automatically Captured I/O
Whatever variant you choose, life-cycle events, sent input, the process's output and errors are stored for you:
kotlin
CommandLine(…).exec().io
CommandLine(…).exec().io.output
CommandLine(…).exec().io.error.ansiRemoved
Typed (Exit) State
- Access the state with
state, which is either an instance ofRunning,Exited(with the sub statesSucceededandFailed) orExcepted. - All states print nicely and provide a copy of all logged I/O, and state-dependent information such as the exit code.
- By default, processes are killed on VM shutdown, which can be configured.
- Life-cycle callbacks can be registered.
Ready to run Docker commands
```kotlin with(tempDir()) { SvgFile.copyTo(resolve("koodies.svg"))
// convert SVG to PNG using command line-style docker command
docker("minidocks/librsvg", "-z", 5, "--output", "koodies.png", "koodies.svg")
resolve("koodies.png") asserting { exists() }
// convert PNG to ASCII art using shell script-style docker command
docker("rafib/awesome-cli-binaries", logger = null) {
"""
/opt/bin/chafa -c full -w 9 koodies.png
"""
}.io.output.ansiKept.let { println(it.resetLines()) }
} ```
Output
kotlin
&kyTTTTTTTTTTTTTTTTTTTTuvvvvvvvvvvvvvvvvvvvvvvvv\.
RR&kyTTTTTTTTTTTTTTTTTvvvvvvvvvvvvvvvvvvvvvvvv\.
BBRR&kyTTTTTTTTTTTTTvvvvvvvvvvvvvvvvvvvvvvvv\.
BBBBRR&kyTTTTTTTTTvvvvvvvvvvvvvvvvvvvvvvvv\.
BBBBBBRR&kyTTTTTvvvvvvvvvvvvvvvvvvvvvvvv\.
BBBBBBBBRR&kyTx}vvvvvvvvvvvvvvvvvvvvvv\.
BBBBBBBBBBRZT}vvvvvvvvvvvvvvvvvvvvvv\.
BBBBBBBBBBQxvvvvvvvvvvvvvvvvvvvvvv\.
BBBBBBBB&xvvvvvvvvvvvvvvvvvvvvvv\.
BBBBBBZzvvvvvvvvvvvvvvvvvvvvvv\.
BBBBZuvvvvvvvvvvvvvvvvvvvvvv▗▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
BBZTvvvvvvvvvvvvvvvvvvvvvv\.▝▜MMMMMMMMMMMMMMMMMMMM
R3vvvvvvvvvvvvvvvvvvvvvv\. .▝▜MMMMMMMMMMMMMMMMMM
vvvvvvvvvvvvvvvvvvvvvv\. .▝▜MMMMMMMMMMMMMMMM
vvvvvvvvvvvvvvvvvvvv\. .▝▜MMMMMMMMMMMMMM
uxvvvvvvvvvvvvvvvvz3x_ ▝▜MMMMMMMMMMMM
▁3uxvvvvvvvvvvvv▁▅&▆▂gx` ▝▜MMMMMMMMMM
Z▅▁3uxvvvvvvvvz▆WWRZ&▆▂gv. `▀WMMMMMMMM
WR&▄▁3uxvvvvvuk▀BWWWRZ&▆▂gv. .\vvz▀WMMMMMM
WWWRZ▅▁3ux▁▂Zg33k▀BWWWRZ&▆▂g}. .\vvvvvvz▀WMM0W
000WWRZ▅▃▆MM▆▂Zg33k▀BWWWRZ&▆▂g}. .\vvvvvvvvvvx▀BBR
00000WMMMMMMMM▆▂Zg33k▀BWWWRZ&▆▂yxxvvvvvvvvvvvvvx▝▀
0000MMMMMMMMMMMM▆▂Zg33k▀BWWWRZ▆▆▂gTxvvvvvvvvvvvvvx
00MMMMMMMMMMMMMMMM▆▂Zg33k▀BWWWRZ&▆▂gTxvvvvvvvvvvvv
MMMMMMMMMMMMMMMMMMMM▆▂Zg33g▀BWWWRZ&▆▂gTxvvvvvvvvvv
- All docker commands (
docker,ubuntu,busybox,curl,download, …) use the path in the receiver to- set the working directory of both the host command and the docker container
- map the host working directory to the container's working directory,
- that is, all files of that directory are equally available in your container instance.
- Low level docker commands:
start,run,stop,kill,remove,search,image,ps - Object-oriented design
- Docker:
engineRunning,info,images,containers,search,exec - DockerImage:
list,isPulled,pull,tagsOnDockerHub - DockerContainer:
start,stop,state,kill,remove
- Docker:
- See ExecutionIntegrationTest.kt and Docker.kt for more examples.
- Kotlin
Published by bkahlert about 5 years ago