git

package
v0.0.0-...-703489d Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveIsLatest

func ResolveIsLatest(r VersionResolver, vr version.Resolver, versionRange string) (bool, error)

ResolveIsLatest will resolve is version given by version.Resolver is the latest one in given version range, using a logic of git.VersionResolver.

Types

type IsLatestStrategy

type IsLatestStrategy func(version.Resolver) func(string) (bool, error)

IsLatestStrategy is used to determine if current version is latest one.

type Remote

type Remote struct {
	Name string
	URL  string
}

Remote represents a remote repository name and address.

type Repository

type Repository interface {
	// Describe will return an output that closely matches that of
	// "git describe --tags --always --dirty" for given repository.
	Describe() (string, error)
	// Tags will return repository tags.
	Tags() ([]string, error)
}

Repository gives information about the git SCM repository.

type StaticRepository

type StaticRepository struct {
	DescribeString string
	TagsSet        strings.Set
}

StaticRepository is stub repo implementation which gives back values provided to it upfront.

func (StaticRepository) Describe

func (s StaticRepository) Describe() (string, error)

func (StaticRepository) Tags

func (s StaticRepository) Tags() ([]string, error)

type VersionResolver

type VersionResolver struct {
	Cache cache.Cache
	IsLatestStrategy
	Repository
	*Remote
}

VersionResolver implements version.Resolver for git SCM.

func NewVersionResolver

func NewVersionResolver(options ...VersionResolverOption) VersionResolver

func (VersionResolver) IsLatest

func (r VersionResolver) IsLatest(versionRange string) (bool, error)

func (VersionResolver) TagBasedIsLatestStrategy

func (r VersionResolver) TagBasedIsLatestStrategy(vr version.Resolver) func(versionRange string) (bool, error)

TagBasedIsLatestStrategy is the default strategy, that uses a repository tags to determine if given version is latest within version range given.

func (VersionResolver) Version

func (r VersionResolver) Version() string

type VersionResolverOption

type VersionResolverOption func(*VersionResolver)

func WithCache

func WithCache(cache cache.Cache) VersionResolverOption

func WithIsLatestStrategy

func WithIsLatestStrategy(strategy IsLatestStrategy) VersionResolverOption

func WithRemote

func WithRemote(remote Remote) VersionResolverOption

func WithRepository

func WithRepository(repository Repository) VersionResolverOption

Jump to

Keyboard shortcuts

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