Skip to content

Commit

Permalink
Grace: update profile and commands
Browse files Browse the repository at this point in the history
  • Loading branch information
rainboyan committed Feb 27, 2024
1 parent 461afe7 commit 8a9f209
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public class GrailsConsole implements ConsoleLogger {

public static final String CATEGORY_SEPARATOR = "|";

public static final String PROMPT = "grails> ";
public static final String PROMPT = "grace> ";

public static final String SPACE = " ";

Expand Down
6 changes: 3 additions & 3 deletions grace-shell/src/main/groovy/org/grails/cli/GrailsCli.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class GrailsCli {
}
catch (Throwable e) {
e = ExceptionUtils.getRootCause(e)
GrailsConsole.instance.error("Error occurred running Grails CLI: $e.message", e)
GrailsConsole.instance.error("Error occurred running Grace CLI: $e.message", e)
exit(1)
}
}
Expand All @@ -203,7 +203,7 @@ class GrailsCli {
private int getBaseUsage() {
System.out.println "Usage: \n\t $USAGE_MESSAGE \n\t $PLUGIN_USAGE_MESSAGE \n\n"
this.execute 'list-profiles'
System.out.println "\nType 'grails help' or 'grails -h' for more information."
System.out.println "\nType 'grace help' or 'grails -h' for more information."

1
}
Expand All @@ -229,7 +229,7 @@ class GrailsCli {
GrailsVersion currentVersion = GrailsVersion.current()
GrailsDependenciesDependencyManagement grailsDependencies = new GrailsDependenciesDependencyManagement()
StringBuilder sb = new StringBuilder()
sb.append('%n------------------------------------------------------------%nGrails ')
sb.append('%n------------------------------------------------------------%nGrace ')
sb.append(currentVersion.getVersion())
sb.append('%n------------------------------------------------------------%n%nBuild time: ')
sb.append(currentVersion.getBuildTimestamp())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ abstract class AbstractProfile implements Profile {
int requiredArgumentCount = requiredArguments?.findAll { CommandArgument ca -> ca.required }?.size() ?: 0
if (commandLine.remainingArgs.size() < requiredArgumentCount) {
context.console.error "Command [$commandName] missing required arguments: ${requiredArguments*.name}. " +
"Type 'grails help $commandName' for more info."
"Type 'grace help $commandName' for more info."
return false
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,14 @@ class HelpCommand implements ProfileCommand, Completer, ProjectContextAware, Pro

console.log '''
Usage (optionals marked with *):'
grails [environment]* [target] [arguments]*'
grace [environment]* [target] [arguments]*'
'''
console.addStatus('Examples:')
console.log('$ grails dev run-app')
console.log('$ grails create-app books')
console.log('$ grace create-app blog')
console.log('$ grace dev run-app')
console.log ''
console.addStatus('Available Commands (type grails help \'command-name\' for more info):')
console.addStatus('Available Commands (type grace help \'command-name\' for more info):')
console.addStatus("${'Command Name'.padRight(37)} Command Description")
console.println('-' * 100)
for (CommandDescription desc : allCommands) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,19 @@ import org.grails.cli.profile.ProfileRepositoryAware
class ListProfilesCommand implements Command, ProfileRepositoryAware {

final String name = 'list-profiles'
final CommandDescription description = new CommandDescription(name, 'Lists the available profiles', 'grails list-profiles')
final CommandDescription description = new CommandDescription(name, 'Lists the available profiles', 'grace list-profiles')

ProfileRepository profileRepository

@Override
boolean handle(ExecutionContext executionContext) {
List<Profile> allProfiles = profileRepository.allProfiles
List<Profile> allProfiles = profileRepository.allProfiles.sort { Profile p -> p.name}
GrailsConsole console = executionContext.console
console.addStatus('Available Profiles')
console.log('--------------------')
console.log('-' * 100)
console.log('Available Profiles')
console.log('-' * 100)
for (Profile p in allProfiles) {
console.log("* $p.name - ${p.description}")
console.log("* ${p.name.padRight(30)} ${p.version.padRight(20)} ${p.description}")
}

true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,12 @@ class ProfileInfoCommand extends ArgumentCompletingCommand implements ProfileRep
console.error("Profile not found for name [$profileName]")
}
else {
console.log("Profile: ${profile.name}")
console.log('--------------------')
console.log("Profile: ${profile.name} v${profile.version}")
console.log('-' * 40)
console.log(profile.description)
console.log('')
console.log('Provided Commands:')
console.log('--------------------')
console.log('-' * 40)
Iterable<Command> commands = findCommands(profile, console).toUnique { Command c -> c.name }

for (cmd in commands) {
Expand All @@ -83,7 +83,7 @@ class ProfileInfoCommand extends ArgumentCompletingCommand implements ProfileRep
}
console.log('')
console.log('Provided Features:')
console.log('--------------------')
console.log('-' * 40)
Iterable<Feature> features = profile.features

for (feature in features) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ abstract class AbstractJarProfileRepository implements ProfileRepository {

protected final List<Profile> allProfiles = []
protected final Map<String, Profile> profilesByName = [:]
protected static final String DEFAULT_PROFILE_GROUPID = 'org.grails.profiles'
protected static final String DEFAULT_PROFILE_GROUPID = 'org.graceframework.profiles'

private final Set<URL> registeredUrls = []

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import org.grails.cli.profile.Profile
class MavenProfileRepository extends AbstractJarProfileRepository {

public static final GrailsRepositoryConfiguration DEFAULT_REPO = new GrailsRepositoryConfiguration(
'grailsCentral', new URI('https://repo.grails.org/grails/core'), true)
'mavenCentral', new URI('https://repo1.maven.org/maven2/'), false)

List<GrailsRepositoryConfiguration> repositoryConfigurations
MavenResolverGrapeEngine grapeEngine
Expand Down Expand Up @@ -126,7 +126,7 @@ class MavenProfileRepository extends AbstractJarProfileRepository {
if (!this.resolved) {
List<Map> profiles = []
this.resolutionContext.managedDependencies.each { Dependency dep ->
if (dep.artifact.groupId == 'org.grails.profiles') {
if (dep.artifact.groupId == 'org.graceframework.profiles') {
profiles.add([group: dep.artifact.groupId, module: dep.artifact.artifactId])
}
}
Expand All @@ -136,7 +136,7 @@ class MavenProfileRepository extends AbstractJarProfileRepository {
this.grapeEngine.grab(profile)
}

def localData = new File(System.getProperty('user.home'), '/.m2/repository/org/grails/profiles')
def localData = new File(System.getProperty('user.home'), '/.m2/repository/org/graceframework/profiles')
if (localData.exists()) {
localData.eachDir { File dir ->
if (!dir.name.startsWith('.')) {
Expand Down

0 comments on commit 8a9f209

Please sign in to comment.