mirror of
https://github.com/kubernetes-sigs/kustomize.git
synced 2026-06-11 17:12:51 +00:00
40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
// Copyright 2022 The Kubernetes Authors.
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package repo
|
|
|
|
import (
|
|
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/misc"
|
|
"sigs.k8s.io/kustomize/cmd/gorepomod/internal/mod"
|
|
)
|
|
|
|
// ManagerFactory is a collection of clean data needed to build
|
|
// clean, fully wired up instances of Manager.
|
|
type ManagerFactory struct {
|
|
dg *DotGitData
|
|
modules []*protoModule
|
|
remoteName misc.TrackedRepo
|
|
versionMapLocal misc.VersionMap
|
|
versionMapRemote misc.VersionMap
|
|
}
|
|
|
|
func (mf *ManagerFactory) NewRepoManager(allowedReplacements []string) *Manager {
|
|
result := &Manager{
|
|
dg: mf.dg,
|
|
remoteName: mf.remoteName,
|
|
}
|
|
var modules misc.LesModules
|
|
for _, pm := range mf.modules {
|
|
shortName := pm.ShortName(mf.dg.RepoPath())
|
|
modules = append(
|
|
modules,
|
|
mod.New(
|
|
result, shortName, pm.mf,
|
|
mf.versionMapLocal.Latest(shortName),
|
|
mf.versionMapRemote.Latest(shortName)))
|
|
}
|
|
result.modules = modules
|
|
result.allowedReplacements = allowedReplacements
|
|
return result
|
|
}
|