Skip to content

Commit

Permalink
Merge pull request #18 from grails-profiles/create-service-command
Browse files Browse the repository at this point in the history
  • Loading branch information
jameskleeh authored Jun 20, 2019
2 parents f6f401f + 67c2a02 commit 3270007
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 0 deletions.
17 changes: 17 additions & 0 deletions commands/create-service.yml
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions templates/artifacts/Service.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@artifact.package@
import grails.gorm.transactions.Transactional

@Transactional
class @artifact.name@Service {

def serviceMethod() {

}
}
17 changes: 17 additions & 0 deletions templates/testing/Service.groovy
Original file line number Diff line number Diff line change
@@ -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
}
}

0 comments on commit 3270007

Please sign in to comment.