repository

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoRepositories is returned by NewMultiRepository if no repositories are
	// configured.
	ErrNoRepositories = errors.New("no skeleton repositories configured")

	// ErrNotARemoteRepository is returned by NewRemoteRepository if the provided
	// info does not describe a remote repository.
	ErrNotARemoteRepository = errors.New("not a remote repository")
)

Functions

func Create

func Create(path, skeletonName string) error

Create creates a new skeleton repository at path and initializes it with a skeleton located in a subdir named skeletonName.

func DisableCache

func DisableCache()

DisableCache disables the repository cache.

func EnableCache

func EnableCache()

EnableCache enables the repository cache. An enabled cache will cause New and NewNamed to return the same Repository instance for consecutive calls with pairs of the same name and url. This can speed up operations on remote skeleton repositories as it reduce the number of git operations that need to be carried out. The speedup may be noticeable when working with skeletons that have parents.

func LoadSkeleton

func LoadSkeleton(ctx context.Context, repo kickoff.Repository, name string) (*kickoff.Skeleton, error)

LoadSkeleton loads the skeleton with name from given repository. The passed in context is propagated to all operations that cross API boundaries (e.g. git operations) and can be used to enforce timeouts or cancel them. Returns an error if loading the skeleton fails.

func LoadSkeletons

func LoadSkeletons(ctx context.Context, repo kickoff.Repository, names []string) ([]*kickoff.Skeleton, error)

LoadSkeletons loads multiple skeletons from given repository. The passed in context is propagated to all operations that cross API boundaries (e.g. git operations) and can be used to enforce timeouts or cancel them. Returns an error if loading of any of the skeletons fails.

func New

func New(url string) (kickoff.Repository, error)

New creates a new kickoff Repository for url. Returns an error if url is not a valid local path or remote url.

func NewFromMap added in v0.1.1

func NewFromMap(repoURLMap map[string]string) (kickoff.Repository, error)

NewFromMap creates a kickoff.Repository which aggregates the repositores from the repoURLMap. The repoURLMap is a mapping of repository name to its url. Returns an error if repoURLMap contains empty keys or if creating individual repositories fails, or if repoURLMap is empty.

func NewFromRef added in v0.1.1

func NewFromRef(ref kickoff.RepoRef) (kickoff.Repository, error)

NewFromRef creates a new kickoff.Repository from a repository reference. Ref may reference a local or remote repository.

func NewNamed

func NewNamed(name, url string) (kickoff.Repository, error)

NewNamed creates a new named Repository. The name is propagated into the repository info that is attached to every skeleton that is retrieved from it. Apart from that is behaves exactly like New.

Types

type DependencyCycleError

type DependencyCycleError struct {
	ParentRef kickoff.ParentRef
}

DependencyCycleError is the error returned while loading a skeleton's parent if a dependency cycle is detected.

func (DependencyCycleError) Error

func (e DependencyCycleError) Error() string

Error implements error.

type SkeletonNotFoundError

type SkeletonNotFoundError struct {
	Name     string
	RepoName string
}

SkeletonNotFoundError is the error returned if a skeleton cannot be found in a repository.

func (SkeletonNotFoundError) Error

func (e SkeletonNotFoundError) Error() string

Error implements error.

Jump to

Keyboard shortcuts

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