Skip to content

Commit

Permalink
Correctly resolve project name if none is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
esotericenderman committed Sep 11, 2024
1 parent e66dec1 commit 05ed0b1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,9 @@ tasks {

tasks.register("renameProject") {
doLast {
val newName = project.findProperty("new-name")?.toString() ?: projectNameString
val oldNameInput = titlecase(projectNameString)

val newName = project.findProperty("new-name")?.toString() ?: oldNameInput
val newAuthorName = project.findProperty("new-author-name")?.toString() ?: mainProjectAuthorName
val newTopLevelDomain = project.findProperty("new-top-level-domain")?.toString() ?: topLevelDomain

Expand Down Expand Up @@ -155,7 +157,7 @@ tasks.register("renameProject") {
currentMainClassFilePath.renameTo(newMainClassFilePath)
}

replaceStringInDirectoryFiles(javaSourcePath.parentFile, titlecase(projectNameString), newName)
replaceStringInDirectoryFiles(javaSourcePath.parentFile, oldNameInput, newName)
replaceStringInDirectoryFiles(javaSourcePath.parentFile, projectGroupString, newGroupString)
replaceStringInDirectoryFiles(javaSourcePath.parentFile, currentMainClassName, newMainClassName)

Expand Down

0 comments on commit 05ed0b1

Please sign in to comment.