File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ object NewProject {
6
6
private const val DOT_SEPARATOR = " ."
7
7
private const val KEY_APP_NAME = " app-name"
8
8
private const val KEY_PACKAGE_NAME = " package-name"
9
+ private const val TEMPLATE_APP_NAME = " Coroutine Template"
9
10
private const val TEMPLATE_APPLICATION_CLASS_NAME = " CoroutineTemplateApplication"
10
11
private const val TEMPLATE_FOLDER_NAME = " CoroutineTemplate"
11
12
private const val TEMPLATE_PACKAGE_NAME = " co.nimblehq.coroutine"
@@ -38,6 +39,7 @@ object NewProject {
38
39
renamePackageNameFolders()
39
40
renamePackageNameWithinFiles()
40
41
renameApplicationClass()
42
+ renameAppName()
41
43
buildProjectAndRunTests()
42
44
}
43
45
@@ -194,6 +196,20 @@ object NewProject {
194
196
}
195
197
}
196
198
199
+ private fun renameAppName () {
200
+ showMessage(" => 🔎 Renaming app name..." )
201
+ File (projectPath)
202
+ ?.walk()
203
+ .filter { it.name == " strings.xml" }
204
+ .forEach { filePath ->
205
+ rename(
206
+ sourcePath = filePath.toString(),
207
+ oldValue = TEMPLATE_APP_NAME ,
208
+ newValue = appName
209
+ )
210
+ }
211
+ }
212
+
197
213
private fun rename (sourcePath : String , oldValue : String , newValue : String ) {
198
214
val sourceFile = File (sourcePath)
199
215
var sourceText = sourceFile.readText()
You can’t perform that action at this time.
0 commit comments