component

package
v0.0.0-...-70df4a6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2024 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrImportCycle errImportCycle

ErrImportCycle is returned when component dependencies form a cycle

View Source
var ErrInvalidDir errInvalidDir

ErrInvalidDir is returned when the repo dir is invalid

Functions

func Generate

func Generate(ctx context.Context, log klog.Logger, output, input, cachedir string, opts Opts) error

Generate reads configs and writes components to the filesystem

func WriteComponents

func WriteComponents(ctx context.Context, log klog.Logger, cache *Cache, fsys fs.FS, components []Component, stderr io.Writer, dryrun bool) error

WriteComponents writes components to an fs

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

Cache is a config engine cache by path

func NewCache

func NewCache(repos *repofetcher.Cache, engines confengine.Map) *Cache

NewCache creates a new *Cache

func (*Cache) Get

func (c *Cache) Get(ctx context.Context, kind string, spec repofetcher.Spec, dir string) (confengine.ConfEngine, error)

func (*Cache) Parse

func (c *Cache) Parse(kind string, repobytes []byte) (repofetcher.Spec, error)

type Component

type Component struct {
	Spec      repofetcher.Spec
	Dir       string
	Templates []Template
}

Component is a package of files to generate

func ParseComponents

func ParseComponents(ctx context.Context, cache *Cache, spec repofetcher.Spec, name string, stderr io.Writer) ([]Component, error)

ParseComponents parses component configs to Component

type Opts

type Opts struct {
	DryRun           bool
	NoNetwork        bool
	ForceFetch       bool
	RepoChecksumFile string
	GitDir           string
	GitBin           string
	GitBinQuiet      bool
	JsonnetLibName   string
}

Opts holds generation opts

type RepoChecksumData

type RepoChecksumData struct {
	Repos []repofetcher.RepoChecksum `json:"repos"`
}

RepoChecksumData is the shape of a repo checksum file

type Template

type Template struct {
	Kind   string         `json:"kind"`
	Path   string         `json:"path"`
	Args   map[string]any `json:"args"`
	Output string         `json:"output"`
}

Template is a file to generate

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL