From 15761642b10b409dbf191fd29ff444eb2dc2c300 Mon Sep 17 00:00:00 2001 From: Rob Rudin Date: Fri, 22 Jul 2016 08:53:09 -0400 Subject: [PATCH] #111 Adding support for deploying custom forests --- .../com/marklogic/gradle/MarkLogicPlugin.groovy | 11 ++++++++++- .../task/forests/DeployCustomForestsTask.groovy | 12 ++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/main/groovy/com/marklogic/gradle/task/forests/DeployCustomForestsTask.groovy diff --git a/src/main/groovy/com/marklogic/gradle/MarkLogicPlugin.groovy b/src/main/groovy/com/marklogic/gradle/MarkLogicPlugin.groovy index a1ba11b9b..a50cf6a4f 100644 --- a/src/main/groovy/com/marklogic/gradle/MarkLogicPlugin.groovy +++ b/src/main/groovy/com/marklogic/gradle/MarkLogicPlugin.groovy @@ -1,5 +1,7 @@ package com.marklogic.gradle +import com.marklogic.appdeployer.command.forests.DeployCustomForestsCommand +import com.marklogic.gradle.task.forests.DeployCustomForestsTask import org.gradle.api.Plugin import org.gradle.api.Project import org.slf4j.LoggerFactory @@ -181,7 +183,8 @@ class MarkLogicPlugin implements Plugin { String forestGroup = "ml-gradle Forest" project.task("mlConfigureForestReplicas", type: ConfigureForestReplicasTask, group: forestGroup, description: "Deprecated - configure forest replicas via the command.forestNamesAndReplicaCounts map") - project.task("mlDeleteForestReplicas", type: DeleteForestReplicasTask, group: forestGroup, description: "Delete forest replicas via the command.forestNamesAndReplicaCounts map") + project.task("mlDeleteForestReplicas", type: DeleteForestReplicasTask, group: forestGroup, description: "Deprecated - delete forest replicas via the command.forestNamesAndReplicaCounts map") + project.task("mlDeployCustomForests", type: DeployCustomForestsTask, group: forestGroup, description: "Deploy custom forests as defined in subdirectories of the forests configuration directory") project.task("mlDeployForestReplicas", type: DeployForestReplicasTask, group: forestGroup, description: "Prefer this over mlConfigureForestReplicas; it does the same thing, but uses the ConfigureForestReplicasCommand that is used by mlDeploy") String groupsGroup = "ml-gradle Group" @@ -384,6 +387,12 @@ class MarkLogicPlugin implements Plugin { project.extensions.add("mlMimetypeCommands", mimetypeCommands) commands.addAll(mimetypeCommands) + // Forests + List forestCommands = new ArrayList() + forestCommands.add(new DeployCustomForestsCommand()) + project.extensions.add("mlForestCommands", forestCommands) + commands.addAll(forestCommands) + // Forest replicas List replicaCommands = new ArrayList() replicaCommands.add(new ConfigureForestReplicasCommand()) diff --git a/src/main/groovy/com/marklogic/gradle/task/forests/DeployCustomForestsTask.groovy b/src/main/groovy/com/marklogic/gradle/task/forests/DeployCustomForestsTask.groovy new file mode 100644 index 000000000..ace763bcb --- /dev/null +++ b/src/main/groovy/com/marklogic/gradle/task/forests/DeployCustomForestsTask.groovy @@ -0,0 +1,12 @@ +package com.marklogic.gradle.task.forests + +import com.marklogic.gradle.task.MarkLogicTask +import org.gradle.api.tasks.TaskAction + +class DeployCustomForestsTask extends MarkLogicTask { + + @TaskAction + void deployCustomForests() { + invokeDeployerCommandWithClassName("DeployCustomForestsCommand") + } +}