diff --git a/commands/create-service.yml b/commands/create-service.yml new file mode 100644 index 0000000..3e3b37e --- /dev/null +++ b/commands/create-service.yml @@ -0,0 +1,17 @@ +description: + - Creates a Service + - usage: 'create-service [service name]' + - completer: org.grails.cli.interactive.completers.DomainClassCompleter + - argument: "Service Name" + description: "The name of the service" + - flag: force + description: Whether to override existing files +steps: + - command: render + template: templates/artifacts/Service.groovy + destination: grails-app/services/@artifact.package.path@/@artifact.name@Service.groovy + convention: Service + - command: render + template: templates/testing/Service.groovy + destination: src/test/groovy/@artifact.package.path@/@artifact.name@ServiceSpec.groovy + convention: Service diff --git a/templates/artifacts/Service.groovy b/templates/artifacts/Service.groovy new file mode 100644 index 0000000..43faf6d --- /dev/null +++ b/templates/artifacts/Service.groovy @@ -0,0 +1,10 @@ +@artifact.package@ +import grails.gorm.transactions.Transactional + +@Transactional +class @artifact.name@Service { + + def serviceMethod() { + + } +} diff --git a/templates/testing/Service.groovy b/templates/testing/Service.groovy new file mode 100644 index 0000000..d43b507 --- /dev/null +++ b/templates/testing/Service.groovy @@ -0,0 +1,17 @@ +@artifact.package@ +import grails.testing.services.ServiceUnitTest +import spock.lang.Specification + +class @artifact.name@ServiceSpec extends Specification implements ServiceUnitTest<@artifact.name@Service>{ + + def setup() { + } + + def cleanup() { + } + + void "test something"() { + expect:"fix me" + true == false + } +}