Skip to content

Commit

Permalink
GRIFFON-487 wrong MVc members set in Application.groovy if a redundan…
Browse files Browse the repository at this point in the history
…t suffix was purged
  • Loading branch information
aalmiray committed Mar 31, 2012
1 parent 79e3b41 commit d9800f7
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions subprojects/griffon-scripts/src/main/groovy/CreateMvc.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -59,31 +59,37 @@ Type in griffon create-addon then execute this command again."""
controllerTemplate = argsMap.group + controllerTemplate
}

String modelClassName = ''
if (!argsMap['skip-model'] && !argsMap['with-model']) {
createArtifact(
name: mvcFullQualifiedClassName,
suffix: 'Model',
type: 'Model',
template: modelTemplate,
path: 'griffon-app/models')
modelClassName = fullyQualifiedClassName
}

String viewClassName = ''
if (!argsMap['skip-view'] && !argsMap['with-view']) {
createArtifact(
name: mvcFullQualifiedClassName,
suffix: 'View',
type: 'View',
template: viewTemplate,
path: 'griffon-app/views')
viewClassName = fullyQualifiedClassName
}

String controllerClassName = ''
if (!argsMap['skip-controller'] && !argsMap['with-controller']) {
createArtifact(
name: mvcFullQualifiedClassName,
suffix: 'Controller',
type: 'Controller',
template: controllerTemplate,
path: 'griffon-app/controllers')
controllerClassName = fullyQualifiedClassName

doCreateIntegrationTest(
name: mvcFullQualifiedClassName,
Expand All @@ -110,9 +116,9 @@ Type in griffon create-addon then execute this command again."""
}

List parts = []
if (!argsMap['skip-model']) parts << """ {"model", "${(argsMap['with-model'] ?: mvcFullQualifiedClassName + 'Model')}"}"""
if (!argsMap['skip-view']) parts << """ {"view", "${(argsMap['with-view'] ?: mvcFullQualifiedClassName + 'View')}"}"""
if (!argsMap['skip-controller']) parts << """ {"controller", "${(argsMap['with-controller'] ?: mvcFullQualifiedClassName + 'Controller')}"}"""
if (!argsMap['skip-model']) parts << """ {"model", "${(argsMap['with-model'] ?: modelClassName)}"}"""
if (!argsMap['skip-view']) parts << """ {"view", "${(argsMap['with-view'] ?: viewClassName)}"}"""
if (!argsMap['skip-controller']) parts << """ {"controller", "${(argsMap['with-controller'] ?: controllerClassName)}"}"""

addonFile.withWriter {
it.write addonText.replaceAll(/\s*Map<String, Map<String, String>> groups = new LinkedHashMap<String, Map<String, String>>\(\);/, """
Expand All @@ -133,9 +139,9 @@ Type in griffon create-addon then execute this command again."""
""")
}
List parts = []
if (!argsMap['skip-model']) parts << " model : '${(argsMap['with-model'] ?: mvcFullQualifiedClassName + 'Model')}'"
if (!argsMap['skip-view']) parts << " view : '${(argsMap['with-view'] ?: mvcFullQualifiedClassName + 'View')}'"
if (!argsMap['skip-controller']) parts << " controller: '${(argsMap['with-controller'] ?: mvcFullQualifiedClassName + 'Controller')}'"
if (!argsMap['skip-model']) parts << " model : '${(argsMap['with-model'] ?: modelClassName)}'"
if (!argsMap['skip-view']) parts << " view : '${(argsMap['with-view'] ?: viewClassName)}'"
if (!argsMap['skip-controller']) parts << " controller: '${(argsMap['with-controller'] ?: controllerClassName)}'"

addonFile.withWriter {
it.write addonText.replaceAll(/\s*def\s*mvcGroups\s*=\s*\[/, """
Expand All @@ -159,9 +165,9 @@ mvcGroups {
}

List parts = []
if (!argsMap['skip-model']) parts << " model = '${(argsMap['with-model'] ?: mvcFullQualifiedClassName + 'Model')}'"
if (!argsMap['skip-view']) parts << " view = '${(argsMap['with-view'] ?: mvcFullQualifiedClassName + 'View')}'"
if (!argsMap['skip-controller']) parts << " controller = '${(argsMap['with-controller'] ?: mvcFullQualifiedClassName + 'Controller')}'"
if (!argsMap['skip-model']) parts << " model = '${(argsMap['with-model'] ?: modelClassName)}'"
if (!argsMap['skip-view']) parts << " view = '${(argsMap['with-view'] ?: viewClassName)}'"
if (!argsMap['skip-controller']) parts << " controller = '${(argsMap['with-controller'] ?: controllerClassName)}'"

applicationConfigFile.withWriter {
it.write configText.replaceAll(/\s*mvcGroups\s*\{/, """
Expand Down

0 comments on commit d9800f7

Please sign in to comment.