Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

GRIFFON-487 wrong MVc members set in Application.groovy if a redundan…

…t suffix was purged
  • Loading branch information...
commit d9800f7cab9e6375dd988a37d32a2b839398a14a 1 parent 79e3b41
Andres Almiray authored March 31, 2012
24  subprojects/griffon-scripts/src/main/groovy/CreateMvc.groovy
@@ -59,6 +59,7 @@ Type in griffon create-addon then execute this command again."""
59 59
         controllerTemplate = argsMap.group + controllerTemplate
60 60
     }
61 61
 
  62
+    String modelClassName = ''
62 63
     if (!argsMap['skip-model'] && !argsMap['with-model']) {
63 64
         createArtifact(
64 65
                 name:     mvcFullQualifiedClassName,
@@ -66,8 +67,10 @@ Type in griffon create-addon then execute this command again."""
66 67
                 type:     'Model',
67 68
                 template: modelTemplate,
68 69
                 path:     'griffon-app/models')
  70
+        modelClassName = fullyQualifiedClassName
69 71
     }
70 72
 
  73
+    String viewClassName = ''
71 74
     if (!argsMap['skip-view'] && !argsMap['with-view']) {
72 75
         createArtifact(
73 76
                 name:     mvcFullQualifiedClassName,
@@ -75,8 +78,10 @@ Type in griffon create-addon then execute this command again."""
75 78
                 type:     'View',
76 79
                 template: viewTemplate,
77 80
                 path:     'griffon-app/views')
  81
+        viewClassName = fullyQualifiedClassName
78 82
     }
79 83
 
  84
+    String controllerClassName = ''
80 85
     if (!argsMap['skip-controller'] && !argsMap['with-controller']) {
81 86
         createArtifact(
82 87
                 name:     mvcFullQualifiedClassName,
@@ -84,6 +89,7 @@ Type in griffon create-addon then execute this command again."""
84 89
                 type:     'Controller',
85 90
                 template: controllerTemplate,
86 91
                 path:     'griffon-app/controllers')
  92
+        controllerClassName = fullyQualifiedClassName
87 93
 
88 94
         doCreateIntegrationTest(
89 95
                 name:   mvcFullQualifiedClassName,
@@ -110,9 +116,9 @@ Type in griffon create-addon then execute this command again."""
110 116
             }
111 117
 
112 118
             List parts = []
113  
-            if (!argsMap['skip-model'])      parts << """            {"model",      "${(argsMap['with-model'] ?: mvcFullQualifiedClassName + 'Model')}"}"""
114  
-            if (!argsMap['skip-view'])       parts << """            {"view",       "${(argsMap['with-view'] ?: mvcFullQualifiedClassName + 'View')}"}"""
115  
-            if (!argsMap['skip-controller']) parts << """            {"controller", "${(argsMap['with-controller'] ?: mvcFullQualifiedClassName + 'Controller')}"}"""
  119
+            if (!argsMap['skip-model'])      parts << """            {"model",      "${(argsMap['with-model'] ?: modelClassName)}"}"""
  120
+            if (!argsMap['skip-view'])       parts << """            {"view",       "${(argsMap['with-view'] ?: viewClassName)}"}"""
  121
+            if (!argsMap['skip-controller']) parts << """            {"controller", "${(argsMap['with-controller'] ?: controllerClassName)}"}"""
116 122
 
117 123
             addonFile.withWriter {
118 124
                 it.write addonText.replaceAll(/\s*Map<String, Map<String, String>> groups = new LinkedHashMap<String, Map<String, String>>\(\);/, """
@@ -133,9 +139,9 @@ Type in griffon create-addon then execute this command again."""
133 139
 """)
134 140
             }
135 141
             List parts = []
136  
-            if (!argsMap['skip-model'])      parts << "            model     : '${(argsMap['with-model'] ?: mvcFullQualifiedClassName + 'Model')}'"
137  
-            if (!argsMap['skip-view'])       parts << "            view      : '${(argsMap['with-view'] ?: mvcFullQualifiedClassName + 'View')}'"
138  
-            if (!argsMap['skip-controller']) parts << "            controller: '${(argsMap['with-controller'] ?: mvcFullQualifiedClassName + 'Controller')}'"
  142
+            if (!argsMap['skip-model'])      parts << "            model     : '${(argsMap['with-model'] ?: modelClassName)}'"
  143
+            if (!argsMap['skip-view'])       parts << "            view      : '${(argsMap['with-view'] ?: viewClassName)}'"
  144
+            if (!argsMap['skip-controller']) parts << "            controller: '${(argsMap['with-controller'] ?: controllerClassName)}'"
139 145
 
140 146
             addonFile.withWriter {
141 147
                 it.write addonText.replaceAll(/\s*def\s*mvcGroups\s*=\s*\[/, """
@@ -159,9 +165,9 @@ mvcGroups {
159 165
         }
160 166
 
161 167
         List parts = []
162  
-        if (!argsMap['skip-model'])      parts << "        model      = '${(argsMap['with-model'] ?: mvcFullQualifiedClassName + 'Model')}'"
163  
-        if (!argsMap['skip-view'])       parts << "        view       = '${(argsMap['with-view'] ?: mvcFullQualifiedClassName + 'View')}'"
164  
-        if (!argsMap['skip-controller']) parts << "        controller = '${(argsMap['with-controller'] ?: mvcFullQualifiedClassName + 'Controller')}'"
  168
+        if (!argsMap['skip-model'])      parts << "        model      = '${(argsMap['with-model'] ?: modelClassName)}'"
  169
+        if (!argsMap['skip-view'])       parts << "        view       = '${(argsMap['with-view'] ?: viewClassName)}'"
  170
+        if (!argsMap['skip-controller']) parts << "        controller = '${(argsMap['with-controller'] ?: controllerClassName)}'"
165 171
 
166 172
         applicationConfigFile.withWriter {
167 173
             it.write configText.replaceAll(/\s*mvcGroups\s*\{/, """

0 notes on commit d9800f7

Please sign in to comment.
Something went wrong with that request. Please try again.