commonrepo

package module
v0.0.0-...-7954b2e Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

README

commonrepo

CommonRepo is a tool for managing multiple inheritance for repository templates.

See testdata/fixtures/schema.yml for an example of the schema.

TODO: Write documentation

Documentation

Overview

Package commonrepo contains the main entrypoint for working with the framework

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonRepo

type CommonRepo struct {
	// Options which can be changed at runtime
	MaxUpstreamDepth int // How deep we will keep cloning upstreams (default: 5)
	// contains filtered or unexported fields
}

CommonRepo provides the top level interface for operations

func New

func New(url string, ref ...string) (cr *CommonRepo, err error)

New returns a new CommonRepo loading the default configuration glob.

This is how this should normally be used.

func NewFrom

func NewFrom(from string, url string, ref ...string) (cr *CommonRepo, err error)

NewFrom returns a new CommonRepo loading the given configuration search glob.

This is mostly useful for testing, since we don't have to use our root configuration.

func NewFromRename

func NewFromRename(repo *repos.Repo, renames []config.Rename) (cr *CommonRepo, err error)

NewFromRename returns a new CommonRepo using the given Repo and renames which might modify the base path for the .commonrepo.yml

func NewFromRepo

func NewFromRepo(from string, repo *repos.Repo) (cr *CommonRepo, err error)

NewFromRepo returns a new CommonRepo using the given Repo and from search glob.

This might be useless but I added it anyway. I'll delete it later if I don't need it.

func (*CommonRepo) AppendConfig

func (cr *CommonRepo) AppendConfig(parent *config.Upstream)

AppendConfig appends the given config.Upstream to this

func (*CommonRepo) Composite

func (cr *CommonRepo) Composite() Composited

Composite brings together all the upstreams into a single map of target file names to their contents

func (*CommonRepo) FlattenUpstreams

func (cr *CommonRepo) FlattenUpstreams() (upstreams []*CommonRepo)

FlattenUpstreams returns a slice of all the upstreams flattened into the inherited order.

This will mutate the config of the CommonRepo and its upstreams in order to apply the downstream include/exclude/rename rules.

func (*CommonRepo) Init

func (cr *CommonRepo) Init() (err error)

func (*CommonRepo) LoadUpstreams

func (cr *CommonRepo) LoadUpstreams(depth int) (errs error)

LoadUpstreams recursively clones all the upstream repositories

func (*CommonRepo) String

func (cr *CommonRepo) String() string

String satisifes the stringer interface and returns repo/from@ref

func (*CommonRepo) Upstreams

func (cr *CommonRepo) Upstreams() (upstreams []*CommonRepo, err error)

Upstreams loads and flattens all the upstream repos into their inheritance order.

type Composited

type Composited map[string]repos.Target

Composited exists as a type just so we can mount the Write* methods on it

func (Composited) Write

func (composite Composited) Write() (err error)

Write writes the composited targets to the repository root

func (Composited) WriteFS

func (composite Composited) WriteFS(fs billy.Filesystem, basePaths ...string) (errs error)

WriteFS writes the composite to the given filesystem

Directories

Path Synopsis
cmd
internal
testutil
Package testutil provides convenience utilities for tests within this repository
Package testutil provides convenience utilities for tests within this repository
pkg
common
Package common contains things which are used across other packages and need to be extracted to prevent import cycles
Package common contains things which are used across other packages and need to be extracted to prevent import cycles
config
Package config provides the functionality to parse a commonrepo configuration file
Package config provides the functionality to parse a commonrepo configuration file
files
Package files includes tools for finding and manipulating the repository files
Package files includes tools for finding and manipulating the repository files
gitutil
Package gitutil provides helpers for dealing with git repositories.
Package gitutil provides helpers for dealing with git repositories.
repos
Package repos provides the Repo type
Package repos provides the Repo type
runner
Package runner contains all the stuff used to run scripts in memory.
Package runner contains all the stuff used to run scripts in memory.

Jump to

Keyboard shortcuts

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