Skip to content

Commit 8eadfe5

Browse files
committed
fix: #14818 - web plugin & plugin adjustments
1 parent 2e03322 commit 8eadfe5

File tree

5 files changed

+62
-3
lines changed

5 files changed

+62
-3
lines changed

grails-profiles/web-plugin/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ ext {
2929
}
3030

3131
dependencies {
32-
profileRuntimeApi project(':grails-profiles-base')
32+
profileRuntimeApi project(':grails-profiles-web')
33+
profileRuntimeApi project(':grails-profiles-plugin')
3334
}
3435

3536
apply {

grails-profiles/web-plugin/profile.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ features:
3131
build:
3232
merge:
3333
- base
34+
- web
3435
- plugin
3536
excludes:
3637
- war
37-
- org.apache.grails.gradle.grails-web
3838

3939

grails-shell-cli/src/main/groovy/org/grails/cli/profile/commands/CreatePluginCommand.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class CreatePluginCommand extends CreateAppCommand {
4848
String getName() { NAME }
4949

5050
@Override
51-
protected String getDefaultProfile() { "web-plugin" }
51+
protected String getDefaultProfile() { "plugin" }
5252

5353
protected boolean validateProfile(Profile profileInstance, String profileName, ExecutionContext executionContext) {
5454
def pluginProfile = profileInstance.extends.find() { Profile parent -> parent.name == 'plugin' }
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* https://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
package org.grails.cli.profile.commands
21+
22+
import groovy.transform.CompileStatic
23+
import org.grails.cli.profile.ExecutionContext
24+
import org.grails.cli.profile.Profile
25+
26+
@CompileStatic
27+
class CreateWebPluginCommand extends CreateAppCommand {
28+
29+
public static final String NAME = "create-web-plugin"
30+
31+
CreateWebPluginCommand() {
32+
description.description = "Creates a web plugin"
33+
description.usage = "create-web-plugin [NAME]"
34+
}
35+
36+
@Override
37+
protected void populateDescription() {
38+
description.argument(name: "Plugin Name", description: "The name of the plugin to create.", required: false)
39+
}
40+
41+
@Override
42+
String getName() { NAME }
43+
44+
@Override
45+
protected String getDefaultProfile() { "web-plugin" }
46+
47+
protected boolean validateProfile(Profile profileInstance, String profileName, ExecutionContext executionContext) {
48+
def pluginProfile = profileInstance.extends.find() { Profile parent -> parent.name == 'plugin' }
49+
if(profileName != 'plugin' && pluginProfile == null) {
50+
executionContext.console.error("No valid plugin profile found for name [$profileName]")
51+
return false
52+
}
53+
else {
54+
return super.validateProfile(profileInstance, profileName)
55+
}
56+
}
57+
}

grails-shell-cli/src/main/resources/META-INF/services/org.grails.cli.profile.Command

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
org.grails.cli.profile.commands.CreateAppCommand
22
org.grails.cli.profile.commands.CreatePluginCommand
3+
org.grails.cli.profile.commands.CreateWebPluginCommand
34
org.grails.cli.profile.commands.CreateProfileCommand
45
org.grails.cli.profile.commands.OpenCommand
56
org.grails.cli.profile.commands.HelpCommand

0 commit comments

Comments
 (0)