From 2ff83e76dc8a189b9cd3c11cf1c2866419bdf3e6 Mon Sep 17 00:00:00 2001 From: Graeme Rocher Date: Wed, 11 Feb 2015 09:35:57 +0100 Subject: [PATCH] Shell: Implement -force for create-* YML commands --- commands/create-controller.yml | 6 ++++-- commands/create-integration-test.yml | 7 +++++-- commands/create-interceptor.yml | 4 +++- commands/create-taglib.json | 18 ------------------ commands/create-taglib.yml | 17 +++++++++++++++++ 5 files changed, 29 insertions(+), 23 deletions(-) delete mode 100644 commands/create-taglib.json create mode 100644 commands/create-taglib.yml diff --git a/commands/create-controller.yml b/commands/create-controller.yml index 5aeb5a8..a67d09c 100644 --- a/commands/create-controller.yml +++ b/commands/create-controller.yml @@ -2,8 +2,10 @@ description: - Creates a controller - usage: 'create-controller [controller name]' - completer: org.grails.cli.interactive.completers.DomainClassCompleter - - argument: "Controller Name" - description: "The name of the controller" + - argument: Controller Name + description: The name of the controller + - flag: force + description: Whether to override existing files steps: - command: render template: templates/artifacts/Controller.groovy diff --git a/commands/create-integration-test.yml b/commands/create-integration-test.yml index 00e0949..b0c7d6e 100644 --- a/commands/create-integration-test.yml +++ b/commands/create-integration-test.yml @@ -1,9 +1,12 @@ -description: +description: - Creates an integration test - usage: 'create-integration-test [test name]' - completer: org.grails.cli.interactive.completers.AllClassCompleter - argument: "Integration Test Name" - description: "The name of the integration test" + description: "The name of the integration test" + - flag: force + description: Whether to override existing files + steps: - command: render template: templates/testing/Integration.groovy diff --git a/commands/create-interceptor.yml b/commands/create-interceptor.yml index 2b3fe81..eeacef9 100644 --- a/commands/create-interceptor.yml +++ b/commands/create-interceptor.yml @@ -4,6 +4,9 @@ description: - completer: org.grails.cli.interactive.completers.DomainClassCompleter - argument: "Interceptor name" description: "The name of the interceptor" + - flag: force + description: Whether to override existing files + steps: - command: render template: templates/artifacts/Interceptor.groovy @@ -13,4 +16,3 @@ steps: template: templates/testing/Interceptor.groovy convention: Interceptor destination: src/test/groovy/@artifact.package.path@/@artifact.name@InterceptorSpec.groovy - diff --git a/commands/create-taglib.json b/commands/create-taglib.json deleted file mode 100644 index a0caa42..0000000 --- a/commands/create-taglib.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Creates a tag library", - "usage": "create-taglib [taglib name]\nCreates a tag library class and an associated unit test\n", - "steps": [ - { - "command": "render", - "template": "templates/artifacts/TagLib.groovy", - "destination": "grails-app/taglib/@artifact.package.path@/@artifact.name@TagLib.groovy", - "convention": "TagLib" - }, - { - "command": "render", - "template": "templates/testing/TagLib.groovy", - "destination": "src/test/groovy/@artifact.package.path@/@artifact.name@TagLibSpec.groovy", - "convention": "TagLib" - } - ] -} diff --git a/commands/create-taglib.yml b/commands/create-taglib.yml new file mode 100644 index 0000000..1285e6c --- /dev/null +++ b/commands/create-taglib.yml @@ -0,0 +1,17 @@ +description: + - Creates a Tag Library + - usage: 'create-taglib [taglib name]' + - completer: org.grails.cli.interactive.completers.DomainClassCompleter + - argument: Tag Library Name + description: The name of the tag library + - flag: force + description: Whether to override existing files +steps: + - command: render + template: templates/artifacts/TagLib.groovy + convention: TagLib + destination: grails-app/taglib/@artifact.package.path@/@artifact.name@TagLib.groovy + - command: render + template: templates/testing/TagLib.groovy + convention: TagLib + destination: src/test/groovy/@artifact.package.path@/@artifact.name@TagLibSpec.groovy