11package reposcaffolding
22
33import (
4+ "fmt"
5+
46 "github.com/devstream-io/devstream/internal/pkg/configmanager"
7+ "github.com/devstream-io/devstream/pkg/util/file"
8+ "github.com/devstream-io/devstream/pkg/util/log"
59 "github.com/devstream-io/devstream/pkg/util/scm"
610 "github.com/devstream-io/devstream/pkg/util/scm/git"
711)
@@ -12,18 +16,30 @@ func InstallRepo(options configmanager.RawOptions) error {
1216 if err != nil {
1317 return err
1418 }
15-
16- // 1. Download and render repo by SourceRepo
19+ // 1. Download repo by SourceRepo
1720 sourceClient , err := scm .NewClient (opts .SourceRepo )
1821 if err != nil {
1922 return err
2023 }
21- gitMap , err := opts . downloadAndRenderScmRepo ( sourceClient )
24+ repoDir , err := sourceClient . DownloadRepo ( )
2225 if err != nil {
26+ log .Debugf ("reposcaffolding process files error: %s" , err )
2327 return err
2428 }
2529
26- // 2. push repo to DestinationRepo
30+ // 2. render repo with variables
31+ appName := opts .DestinationRepo .Repo
32+ gitMap , err := file .GetFileMapByWalkDir (
33+ repoDir , filterGitFiles ,
34+ getRepoFileNameFunc (appName , opts .SourceRepo .GetRepoNameWithBranch ()),
35+ processRepoFileFunc (appName , opts .renderTplConfig ()),
36+ )
37+ if err != nil {
38+ log .Warnf ("repoScaffolding render repoTemplate failed=> %+v" , err )
39+ return fmt .Errorf ("render RepoTemplate files failed" )
40+ }
41+
42+ // 3. push repo to DestinationRepo
2743 dstClient , err := scm .NewClientWithAuth (opts .DestinationRepo )
2844 if err != nil {
2945 return err
0 commit comments