@@ -23,8 +23,9 @@ public class Bootstrapper {
23
23
24
24
private MustacheFactory mustacheFactory = new DefaultMustacheFactory ();
25
25
26
- private static final List <String > TOP_LEVEL_STATIC_FILES =
27
- List .of (".gitignore" , "README.md" );
26
+ // .gitignore gets excluded from resource, using here a prefixed version
27
+ private static final Map <String , String > TOP_LEVEL_STATIC_FILES =
28
+ Map .of ("_.gitignore" , ".gitignore" , "README.md" , "README.md" );
28
29
private static final List <String > JAVA_FILES =
29
30
List .of ("CustomResource.java" , "Reconciler.java" ,
30
31
"Spec.java" , "Status.java" );
@@ -106,22 +107,23 @@ private void addTemplatedFile(File projectDir, String fileName, String groupId,
106
107
}
107
108
108
109
private void addStaticFiles (File projectDir ) {
109
- TOP_LEVEL_STATIC_FILES .forEach (f -> addStaticFile (projectDir , f ));
110
+ TOP_LEVEL_STATIC_FILES .forEach (( key , value ) -> addStaticFile (projectDir , key , value ));
110
111
}
111
112
112
- private void addStaticFile (File targetDir , String fileName ) {
113
- addStaticFile (targetDir , fileName , null );
113
+ private void addStaticFile (File targetDir , String fileName , String targetFileName ) {
114
+ addStaticFile (targetDir , fileName , targetFileName , null );
114
115
}
115
116
116
- private void addStaticFile (File targetDir , String fileName , String subDir ) {
117
+ private void addStaticFile (File targetDir , String fileName , String targetFilename ,
118
+ String subDir ) {
117
119
String sourcePath = subDir == null ? "/static/" : "/static/" + subDir ;
118
120
String path = sourcePath + fileName ;
119
121
try (var is = Bootstrapper .class .getResourceAsStream (path )) {
120
122
targetDir = subDir == null ? targetDir : new File (targetDir , subDir );
121
123
if (subDir != null ) {
122
124
FileUtils .forceMkdir (targetDir );
123
125
}
124
- FileUtils .copyInputStreamToFile (is , new File (targetDir , fileName ));
126
+ FileUtils .copyInputStreamToFile (is , new File (targetDir , targetFilename ));
125
127
} catch (IOException e ) {
126
128
throw new RuntimeException ("File path: " + path , e );
127
129
}
0 commit comments