From 5eaa930094e46fd2bc1ed22956bd8d05a30dc1da Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Fri, 22 Mar 2024 22:55:31 -0700 Subject: [PATCH] rename op parameters to configure --- .../ResourceFactoryExtension.kt | 24 ++++++------- .../resourcefactory/bukkit/BukkitPluginYml.kt | 4 +-- .../resourcefactory/bungee/BungeePluginYml.kt | 4 +-- .../resourcefactory/fabric/FabricModJson.kt | 36 +++++++++---------- .../resourcefactory/paper/PaperPluginYml.kt | 8 ++--- .../velocity/VelocityPluginJson.kt | 4 +-- 6 files changed, 40 insertions(+), 40 deletions(-) diff --git a/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/ResourceFactoryExtension.kt b/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/ResourceFactoryExtension.kt index 691acb5..1803982 100644 --- a/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/ResourceFactoryExtension.kt +++ b/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/ResourceFactoryExtension.kt @@ -24,32 +24,32 @@ abstract class ResourceFactoryExtension @Inject constructor( ) { abstract val factories: ListProperty - fun paperPluginYml(op: Action): PaperPluginYml { - val config = project.paperPluginYml(op) + fun paperPluginYml(configure: Action): PaperPluginYml { + val config = project.paperPluginYml(configure) factory(config.resourceFactory()) return config } - fun bukkitPluginYml(op: Action): BukkitPluginYml { - val config = project.bukkitPluginYml(op) + fun bukkitPluginYml(configure: Action): BukkitPluginYml { + val config = project.bukkitPluginYml(configure) factory(config.resourceFactory()) return config } - fun velocityPluginJson(op: Action): VelocityPluginJson { - val config = project.velocityPluginJson(op) + fun velocityPluginJson(configure: Action): VelocityPluginJson { + val config = project.velocityPluginJson(configure) factory(config.resourceFactory()) return config } - fun fabricModJson(op: Action): FabricModJson { - val config = project.fabricModJson(op) + fun fabricModJson(configure: Action): FabricModJson { + val config = project.fabricModJson(configure) factory(config.resourceFactory()) return config } - fun bungeePluginYml(op: Action): BungeePluginYml { - val config = project.bungeePluginYml(op) + fun bungeePluginYml(configure: Action): BungeePluginYml { + val config = project.bungeePluginYml(configure) factory(config.resourceFactory()) return config } @@ -57,10 +57,10 @@ abstract class ResourceFactoryExtension @Inject constructor( fun factory( generatorType: KClass, vararg params: Any, - op: Action + configure: Action ): T { val o = objects.newInstance(generatorType, *params) - op.execute(o) + configure.execute(o) factory(o) return o } diff --git a/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/bukkit/BukkitPluginYml.kt b/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/bukkit/BukkitPluginYml.kt index 4a29762..a5be2fa 100644 --- a/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/bukkit/BukkitPluginYml.kt +++ b/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/bukkit/BukkitPluginYml.kt @@ -21,10 +21,10 @@ import xyz.jpenilla.resourcefactory.util.nullAction import xyz.jpenilla.resourcefactory.util.nullIfEmpty import java.nio.file.Path -fun Project.bukkitPluginYml(op: Action = nullAction()): BukkitPluginYml { +fun Project.bukkitPluginYml(configure: Action = nullAction()): BukkitPluginYml { val yml = BukkitPluginYml(objects) yml.copyProjectMeta(this) - op.execute(yml) + configure.execute(yml) return yml } diff --git a/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/bungee/BungeePluginYml.kt b/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/bungee/BungeePluginYml.kt index 6dec742..601daf4 100644 --- a/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/bungee/BungeePluginYml.kt +++ b/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/bungee/BungeePluginYml.kt @@ -19,10 +19,10 @@ import xyz.jpenilla.resourcefactory.util.nullAction import xyz.jpenilla.resourcefactory.util.nullIfEmpty import java.nio.file.Path -fun Project.bungeePluginYml(op: Action = nullAction()): BungeePluginYml { +fun Project.bungeePluginYml(configure: Action = nullAction()): BungeePluginYml { val yml = BungeePluginYml(objects) yml.copyProjectMeta(this) - op.execute(yml) + configure.execute(yml) return yml } diff --git a/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/fabric/FabricModJson.kt b/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/fabric/FabricModJson.kt index f7dbf95..0bf4104 100644 --- a/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/fabric/FabricModJson.kt +++ b/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/fabric/FabricModJson.kt @@ -27,10 +27,10 @@ import java.lang.reflect.Type import java.nio.file.Path import javax.inject.Inject -fun Project.fabricModJson(op: Action = nullAction()): FabricModJson { +fun Project.fabricModJson(configure: Action = nullAction()): FabricModJson { val yml = FabricModJson(objects) yml.copyProjectMeta(this) - op.execute(yml) + configure.execute(yml) return yml } @@ -52,20 +52,20 @@ open class FabricModJson constructor( @get:Nested val entrypoints: ListProperty = objects.listProperty() - fun mainEntrypoint(value: String, op: Action = nullAction()) = - entrypoint("main", value, op) + fun mainEntrypoint(value: String, configure: Action = nullAction()) = + entrypoint("main", value, configure) - fun clientEntrypoint(value: String, op: Action = nullAction()) = - entrypoint("client", value, op) + fun clientEntrypoint(value: String, configure: Action = nullAction()) = + entrypoint("client", value, configure) - fun serverEntrypoint(value: String, op: Action = nullAction()) = - entrypoint("server", value, op) + fun serverEntrypoint(value: String, configure: Action = nullAction()) = + entrypoint("server", value, configure) - fun entrypoint(type: String, value: String, op: Action = nullAction()): Entrypoint { + fun entrypoint(type: String, value: String, configure: Action = nullAction()): Entrypoint { val ep = objects.newInstance(Entrypoint::class) ep.type.set(type) ep.value.set(value) - op.execute(ep) + configure.execute(ep) entrypoints.add(ep) return ep } @@ -76,10 +76,10 @@ open class FabricModJson constructor( @get:Nested val mixins: ListProperty = objects.listProperty() - fun mixin(name: String, op: Action = nullAction()): MixinConfig { + fun mixin(name: String, configure: Action = nullAction()): MixinConfig { val mixin = objects.newInstance(MixinConfig::class) mixin.config.set(name) - op.execute(mixin) + configure.execute(mixin) mixins.add(mixin) return mixin } @@ -124,17 +124,17 @@ open class FabricModJson constructor( @get:Nested val authors: ListProperty = objects.listProperty() - fun author(name: String, op: Action = nullAction()) = authors.add(person(name, op)) + fun author(name: String, configure: Action = nullAction()) = authors.add(person(name, configure)) @get:Nested val contributors: ListProperty = objects.listProperty() - fun contributor(name: String, op: Action = nullAction()) = contributors.add(person(name, op)) + fun contributor(name: String, configure: Action = nullAction()) = contributors.add(person(name, configure)) @get:Nested val contact: ContactInformation = objects.newInstance() - fun contact(op: Action) = contact.apply { op.execute(this) } + fun contact(configure: Action) = contact.apply { configure.execute(this) } @get:Input val license: ListProperty = objects.listProperty() @@ -191,9 +191,9 @@ open class FabricModJson constructor( val icons: Map ) : Icon - fun person(name: String, op: Action = nullAction()): Person = objects.newInstance().apply { + fun person(name: String, configure: Action = nullAction()): Person = objects.newInstance().apply { this.name.set(name) - op.execute(this) + configure.execute(this) } abstract class Person @Inject constructor(objects: ObjectFactory) { @@ -203,7 +203,7 @@ open class FabricModJson constructor( @get:Nested val contact: ContactInformation = objects.newInstance() - fun contact(op: Action) = contact.apply { op.execute(this) } + fun contact(configure: Action) = contact.apply { configure.execute(this) } } abstract class ContactInformation { diff --git a/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/paper/PaperPluginYml.kt b/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/paper/PaperPluginYml.kt index 12dda89..dda1e65 100644 --- a/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/paper/PaperPluginYml.kt +++ b/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/paper/PaperPluginYml.kt @@ -26,10 +26,10 @@ import xyz.jpenilla.resourcefactory.util.nullIfEmpty import java.nio.file.Path import javax.inject.Inject -fun Project.paperPluginYml(op: Action = nullAction()): PaperPluginYml { +fun Project.paperPluginYml(configure: Action = nullAction()): PaperPluginYml { val yml = PaperPluginYml(objects) yml.copyProjectMeta(this) - op.execute(yml) + configure.execute(yml) return yml } @@ -92,8 +92,8 @@ class PaperPluginYml constructor( @get:Nested val permissions: NamedDomainObjectContainer = objects.domainObjectContainer(Permission::class) { Permission(it) } - fun dependencies(op: Action) { - op.execute(dependencies) + fun dependencies(configure: Action) { + configure.execute(dependencies) } /** diff --git a/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/velocity/VelocityPluginJson.kt b/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/velocity/VelocityPluginJson.kt index 80e9a86..c02ec6b 100644 --- a/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/velocity/VelocityPluginJson.kt +++ b/plugin/src/main/kotlin/xyz/jpenilla/resourcefactory/velocity/VelocityPluginJson.kt @@ -19,10 +19,10 @@ import xyz.jpenilla.resourcefactory.util.nullAction import xyz.jpenilla.resourcefactory.util.nullIfEmpty import java.nio.file.Path -fun Project.velocityPluginJson(op: Action = nullAction()): VelocityPluginJson { +fun Project.velocityPluginJson(configure: Action = nullAction()): VelocityPluginJson { val yml = VelocityPluginJson(objects) yml.copyProjectMeta(this) - op.execute(yml) + configure.execute(yml) return yml }