vcs

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RepoRoot added in v0.1.2

func RepoRoot(ctx context.Context, module string) (root string, path string, err error)

Types

type Auth

type Auth struct {
	Username string
	Password string
	Key      string
}

Auth defines a typical VCS authentication mechanism, such as SSH key or username/password.

func Key

func Key(key string) Auth

Key returns an Auth implementation that uses key file authentication mechanism.

func NoAuth

func NoAuth() Auth

NoAuth returns an Auth implementation that uses no authentication at all.

func Password

func Password(username, password string) Auth

Password returns an Auth implementation that authenticate via username and password.

type Module

type Module interface {
	Timestamp(ctx context.Context, version Version) (time.Time, error)
	Zip(ctx context.Context, version Version) (io.ReadCloser, error)
}

Module is a source code snapshot for which one can get the commit timestamp or the actual ZIP with the source code in it.

type VCS

type VCS interface {
	List(ctx context.Context) ([]Version, error)
	Module
}

VCS is a version control system client. It can list available versions from the remote, as well as fetch module data such as timestamp or zip snapshot.

func NewCommand added in v0.1.3

func NewCommand(l logger, cmd string, module string) VCS

func NewGit

func NewGit(l logger, dir string, module string, auth Auth) VCS

NewGit return a go-git VCS client implementation that provides information about the specific module using the pgiven authentication mechanism.

func NewGoMod added in v0.1.9

func NewGoMod(l logger, module string) VCS

type Version

type Version string

Version represents a semantic version of a module.

func (Version) Hash

func (v Version) Hash() string

Hash returns a commit hash if a version is of a form v0.0.0-timestamp-hash.

func (Version) IsSemVer

func (v Version) IsSemVer() bool

IsSemVer returns true if a version string is a semantic version e.g. vX.Y.Z.

func (Version) String added in v0.1.3

func (v Version) String() string

String returns a string representation of a version

Jump to

Keyboard shortcuts

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