Skip to content

Commit

Permalink
Update scaffolding scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan committed Jan 13, 2024
1 parent 85b6c14 commit 93e9c1b
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def model = model(args[0])
def overwrite = flag('force') ? true : false

render template: template('scaffolding/ScaffoldedController.groovy'),
destination: file("grails-app/controllers/${model.packagePath}/${model.convention("Controller")}.groovy"),
destination: file("app/controllers/${model.packagePath}/${model.convention("Controller")}.groovy"),
model: model,
overwrite: overwrite

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.grails.cli.interactive.completers.DomainClassCompleter

description("Generates a controller that performs CRUD operations and the associated views") {
usage "grails generate-all [DOMAIN CLASS]"
usage "grace generate-all [DOMAIN CLASS]"
argument name: 'Domain Class', description: "The name of the domain class", required: true
completer DomainClassCompleter
flag name: 'force', description: "Whether to overwrite existing files"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.grails.cli.interactive.completers.DomainClassCompleter

description( "Generates an asynchronous controller that performs CRUD operations" ) {
usage "grails generate-async-controller [DOMAIN CLASS]"
usage "grace generate-async-controller [DOMAIN CLASS]"
completer DomainClassCompleter
flag name:'force', description:"Whether to overwrite existing files"
}
Expand All @@ -10,7 +10,7 @@ description( "Generates an asynchronous controller that performs CRUD operations
if(args) {
def classNames = args
if(args[0] == '*') {
classNames = resources("file:grails-app/domain/**/*.groovy")
classNames = resources("file:app/domain/**/*.groovy")
.collect { className(it) }
}
for(arg in classNames) {
Expand All @@ -19,7 +19,7 @@ if(args) {
if(sourceClass) {
def model = model(sourceClass)
render template: template('scaffolding/AsyncController.groovy'),
destination: file("grails-app/controllers/${model.packagePath}/${model.convention('Controller')}.groovy"),
destination: file("app/controllers/${model.packagePath}/${model.convention('Controller')}.groovy"),
model: model,
overwrite: overwrite

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.grails.cli.interactive.completers.DomainClassCompleter

description( "Generates a controller that performs CRUD operations" ) {
usage "grails generate-controller [DOMAIN CLASS]"
usage "grace generate-controller [DOMAIN CLASS]"
completer DomainClassCompleter
flag name:'force', description:"Whether to overwrite existing files"
}
Expand All @@ -10,7 +10,7 @@ description( "Generates a controller that performs CRUD operations" ) {
if(args) {
def classNames = args
if(args[0] == '*') {
classNames = resources("file:grails-app/domain/**/*.groovy")
classNames = resources("file:app/domain/**/*.groovy")
.collect { className(it) }
}
for(arg in classNames) {
Expand All @@ -19,12 +19,12 @@ if(args) {
if(sourceClass) {
def model = model(sourceClass)
render template: template('scaffolding/Controller.groovy'),
destination: file("grails-app/controllers/${model.packagePath}/${model.convention('Controller')}.groovy"),
destination: file("app/controllers/${model.packagePath}/${model.convention('Controller')}.groovy"),
model: model,
overwrite: overwrite

render template: template('scaffolding/Service.groovy'),
destination: file("grails-app/services/${model.packagePath}/${model.convention('Service')}.groovy"),
destination: file("app/services/${model.packagePath}/${model.convention('Service')}.groovy"),
model: model,
overwrite: overwrite

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.grails.cli.interactive.completers.DomainClassCompleter

description( "Generates GSP views for the specified domain class" ) {
usage "grails generate-views [DOMAIN CLASS]|*"
usage "grace generate-views [DOMAIN CLASS]|*"
argument name:'Domain Class', description:"The name of the domain class, or '*' for all", required:true
completer DomainClassCompleter
flag name:'force', description:"Whether to overwrite existing files"
Expand All @@ -10,7 +10,7 @@ description( "Generates GSP views for the specified domain class" ) {
if(args) {
def classNames = args
if(args[0] == '*') {
classNames = resources("file:grails-app/domain/**/*.groovy").collect { className(it) }
classNames = resources("file:app/domain/**/*.groovy").collect { className(it) }
}
def viewNames = resources("file:src/main/templates/scaffolding/*.gsp")
.collect {
Expand All @@ -30,7 +30,7 @@ if(args) {
def model = model(sourceClass)
viewNames.each {
render template: template('scaffolding/'+it),
destination: file("grails-app/views/${model.propertyName}/"+it),
destination: file("app/views/${model.propertyName}/"+it),
model: model,
overwrite: overwrite
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

description "Installs scaffolding templates that use f:all to render properties", "grails install-templates"
description "Installs scaffolding templates that use f:all to render properties", "grace install-templates"

updateStatus "Copying scaffolding templates"
mkdir "src/main/templates/scaffolding"
Expand Down

0 comments on commit 93e9c1b

Please sign in to comment.