File tree Expand file tree Collapse file tree 2 files changed +22
-2
lines changed
grails-shell/src/main/groovy/org/grails/cli/profile/commands Expand file tree Collapse file tree 2 files changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -137,8 +137,7 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos
137137 def profileName = evaluateProfileName(mainCommandLine)
138138
139139 Profile profileInstance = profileRepository. getProfile(profileName)
140- if (profileInstance == null ) {
141- executionContext. console. error(" Profile not found for name [$profileName ]" )
140+ if ( ! validateProfile(profileInstance, profileName, executionContext)) {
142141 return false
143142 }
144143 List<Feature > features = evaluateFeatures(profileInstance, mainCommandLine). toList()
@@ -202,6 +201,14 @@ class CreateAppCommand extends ArgumentCompletingCommand implements ProfileRepos
202201 }
203202 }
204203
204+ protected boolean validateProfile (Profile profileInstance , String profileName , ExecutionContext executionContext ) {
205+ if (profileInstance == null ) {
206+ executionContext. console. error(" Profile not found for name [$profileName ]" )
207+ return false
208+ }
209+ return true
210+ }
211+
205212 private Map<URL , File > unzippedDirectories = new LinkedHashMap<URL , File > ()
206213 @CompileDynamic
207214 protected File unzipProfile (AntBuilder ant , Resource location ) {
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ package org.grails.cli.profile.commands
1818
1919import groovy.transform.CompileStatic
2020import org.grails.build.parsing.CommandLine
21+ import org.grails.cli.profile.ExecutionContext
22+ import org.grails.cli.profile.Profile
2123
2224
2325/**
@@ -48,5 +50,16 @@ class CreatePluginCommand extends CreateAppCommand {
4850 @Override
4951 protected String getDefaultProfile () { " web-plugin" }
5052
53+ @Override
54+ protected boolean validateProfile (Profile profileInstance , String profileName , ExecutionContext executionContext ) {
5155
56+ def pluginProfile = profileInstance. extends. find() { Profile parent -> parent. name == ' plugin' }
57+ if (pluginProfile == null ) {
58+ executionContext. console. error(" No valid plugin profile found for name [$profileName ]" )
59+ return false
60+ }
61+ else {
62+ return super . validateProfile(profileInstance, profileName, executionContext)
63+ }
64+ }
5265}
You can’t perform that action at this time.
0 commit comments