@@ -23,8 +23,9 @@ public class Bootstrapper {
2323
2424 private MustacheFactory mustacheFactory = new DefaultMustacheFactory ();
2525
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" );
2829 private static final List <String > JAVA_FILES =
2930 List .of ("CustomResource.java" , "Reconciler.java" ,
3031 "Spec.java" , "Status.java" );
@@ -106,22 +107,23 @@ private void addTemplatedFile(File projectDir, String fileName, String groupId,
106107 }
107108
108109 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 ));
110111 }
111112
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 );
114115 }
115116
116- private void addStaticFile (File targetDir , String fileName , String subDir ) {
117+ private void addStaticFile (File targetDir , String fileName , String targetFilename ,
118+ String subDir ) {
117119 String sourcePath = subDir == null ? "/static/" : "/static/" + subDir ;
118120 String path = sourcePath + fileName ;
119121 try (var is = Bootstrapper .class .getResourceAsStream (path )) {
120122 targetDir = subDir == null ? targetDir : new File (targetDir , subDir );
121123 if (subDir != null ) {
122124 FileUtils .forceMkdir (targetDir );
123125 }
124- FileUtils .copyInputStreamToFile (is , new File (targetDir , fileName ));
126+ FileUtils .copyInputStreamToFile (is , new File (targetDir , targetFilename ));
125127 } catch (IOException e ) {
126128 throw new RuntimeException ("File path: " + path , e );
127129 }
0 commit comments