Skip to content

Commit d93eeb6

Browse files
committed
#504 mlDeleteForestReplicas now requires confirmation
1 parent 645b8a1 commit d93eeb6

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

src/main/groovy/com/marklogic/gradle/MarkLogicPlugin.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class MarkLogicPlugin implements Plugin<Project> {
208208

209209
String forestGroup = "ml-gradle Forest"
210210
project.task("mlConfigureForestReplicas", type: ConfigureForestReplicasTask, group: forestGroup, description: "Deprecated - configure forest replicas via the command.forestNamesAndReplicaCounts map")
211-
project.task("mlDeleteForestReplicas", type: DeleteForestReplicasTask, group: forestGroup, description: "Deprecated - delete forest replicas via the command.forestNamesAndReplicaCounts map")
211+
project.task("mlDeleteForestReplicas", type: DeleteForestReplicasTask, group: forestGroup, description: "Deprecated - delete forest replicas via the command.forestNamesAndReplicaCounts map; requires -Pconfirm=true to be set so this isn't accidentally executed")
212212
project.task("mlDeployCustomForests", type: DeployCustomForestsTask, group: forestGroup, description: "Deploy custom forests as defined in subdirectories of the forests configuration directory")
213213
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")
214214
project.task("mlPrintForestPlan", type: PrintForestPlanTask, group: forestGroup, description: "Print a list of primary forests to be created for a database specified by -Pdatabase=(name of database) when the database is next deployed")
@@ -313,7 +313,7 @@ class MarkLogicPlugin implements Plugin<Project> {
313313
project.task("mlUnitTest", type: UnitTestTask, group: unitTestGroup, description: "Run tests found under /test/suites in the modules database. " +
314314
"Connects to MarkLogic via the REST API server defined by mlTestRestPort (or by mlRestPort if mlTestRestPort is not set), and uses mlRest* properties for authentication. " +
315315
"Use -PunitTestResultsPath to override where test result files are written, which defaults to build/test-results/marklogic-unit-test. " +
316-
"Use -PrunCodeCoverage to enable code coverage support when running the tests. " +
316+
"Use -PrunCodeCoverage to enable code coverage support when running the tests. " +
317317
"Use -PrunTeardown and -PrunSuiteTeardown to control whether teardown and suite teardown scripts are run; these default to 'true' and can be set to 'false' instead. ")
318318

319319
logger.info("Finished initializing ml-gradle\n")
Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
package com.marklogic.gradle.task.forests
22

3-
import org.gradle.api.tasks.TaskAction
4-
53
import com.marklogic.appdeployer.command.forests.ConfigureForestReplicasCommand
6-
import com.marklogic.gradle.task.MarkLogicTask
4+
import com.marklogic.gradle.task.AbstractConfirmableTask
75

86
/**
9-
* Task for invoking "undo" on an instance of ConfigureForestReplicasCommand. The command is exposed as a task
10-
* attribute so that its map of forest names and replica counts and be configured easily in a Gradle build file.
7+
* Task for invoking "undo" on an instance of ConfigureForestReplicasCommand. The command is exposed as a task
8+
* attribute so that its map of forest names and replica counts and be configured easily in a Gradle build file.
119
*/
12-
class DeleteForestReplicasTask extends MarkLogicTask {
10+
class DeleteForestReplicasTask extends AbstractConfirmableTask {
1311

14-
ConfigureForestReplicasCommand command = new ConfigureForestReplicasCommand()
12+
ConfigureForestReplicasCommand command = new ConfigureForestReplicasCommand()
1513

16-
@TaskAction
17-
void deleteForestReplicas() {
18-
command.undo(getCommandContext())
19-
}
14+
@Override
15+
void executeIfConfirmed() {
16+
command.undo(getCommandContext())
17+
}
2018
}

0 commit comments

Comments
 (0)