Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

Added create-service command - https://github.com/grails/grails-core/… #18

Merged
merged 1 commit into from
Jun 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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@/@[email protected]
convention: Service
- command: render
template: templates/testing/Service.groovy
destination: src/test/groovy/@artifact.package.path@/@[email protected]
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
}
}