-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Thinking about how FileSystem should be installed, serializableCompon…
…ents seems to really need a builder pattern
- Loading branch information
Showing
13 changed files
with
80 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
geary-core/src/commonMain/kotlin/com/mineinabyss/geary/modules/GearyConfiguration.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.mineinabyss.geary.modules | ||
|
||
import com.mineinabyss.ding.DI | ||
import com.mineinabyss.geary.addons.GearyPhase | ||
import com.mineinabyss.geary.addons.Namespaced | ||
import com.mineinabyss.geary.addons.dsl.GearyAddon | ||
import com.mineinabyss.geary.addons.dsl.GearyAddonWithDefault | ||
import com.mineinabyss.geary.addons.dsl.GearyDSL | ||
|
||
@GearyDSL | ||
class GearyConfiguration { | ||
inline fun <T : GearyAddonWithDefault<Module>, reified Module: Any> install( | ||
addon: T, | ||
) = install(addon, addon.default()) | ||
|
||
inline fun <T : GearyAddon<Module>, reified Module: Any> install( | ||
addon: T, | ||
module: Module, | ||
) { | ||
DI.add(module) | ||
with(addon) { module.install() } | ||
} | ||
|
||
fun namespace(namespace: String, configure: Namespaced.() -> Unit) { | ||
Namespaced(namespace, TODO(), this).configure() | ||
} | ||
/** | ||
* Allows defining actions that should run at a specific phase during startup | ||
* | ||
* Within its context, invoke a [GearyPhase] to run something during it, ex: | ||
* | ||
* ``` | ||
* GearyLoadPhase.ENABLE { | ||
* // run code here | ||
* } | ||
* ``` | ||
*/ | ||
|
||
fun on(phase: GearyPhase, run: () -> Unit) { | ||
geary.pipeline.intercept(phase, run) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...y-serialization/src/commonMain/kotlin/com/mineinabyss/geary/serialization/GearyAliases.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.mineinabyss.geary.serialization | ||
|
||
|
||
typealias GearySerializers = Serializers | ||
typealias GearySerializers = ComponentSerializers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
...erialization/src/commonMain/kotlin/com/mineinabyss/geary/serialization/formats/Formats.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters