release

package
v0.6.4 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2017 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// MetaFileName is the name of metadata file.
	MetaFileName = "meta.yml"
)

Variables

This section is empty.

Functions

func IsChecksumError added in v0.6.0

func IsChecksumError(err error) bool

IsChecksumError returns that the type of err matches InvalidChecksumError type or not.

func Now

func Now() string

Now returns the current UTC timestamp.

func ParseName added in v0.4.0

func ParseName(str string) (bool, string)

ParseName parses a formatted name, and returns the bool of the success or false and the formatted name.

Types

type Binary

type Binary struct {
	Name     string      `yaml:"name"`
	Checksum string      `yaml:"checksum"`
	Mode     os.FileMode `yaml:"mode"`
	Body     io.Reader   `yaml:"-"`
}

Binary represents the binary file within release.

func BuildBinary

func BuildBinary(name string, mode os.FileMode, body io.Reader) (*Binary, error)

BuildBinary builds a Binary object. Return error if it is failed to calculate checksum of the body.

func (*Binary) CopyAndValidateChecksum added in v0.6.0

func (b *Binary) CopyAndValidateChecksum(dst io.Writer, src io.Reader) (int64, error)

CopyAndValidateChecksum copies src to dst and calculate checksum of src, then check it.

func (*Binary) Inspect added in v0.3.0

func (b *Binary) Inspect(w io.Writer)

Inspect prints the binary information.

type InvalidChecksumError added in v0.6.0

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

InvalidChecksumError represents an error of the checksum.

func (*InvalidChecksumError) Error added in v0.6.0

func (e *InvalidChecksumError) Error() string

Error returns the error message for InvalidChecksumError.

type Meta

type Meta struct {
	Binaries []*Binary `yaml:"binaries"`
}

Meta represents metadata of a release.

func NewMeta

func NewMeta(bins []*Binary) *Meta

NewMeta returns a Meta object.

type Release

type Release struct {
	Meta *Meta
	URL  *url.URL
}

Release represents a `<host>/<user>/<project>/<timestamp>/` layout.

func New

func New(meta *Meta, u *url.URL) *Release

New returns a Release object.

func (*Release) Inspect added in v0.3.0

func (rel *Release) Inspect(w io.Writer)

Inspect inspetcs the release information.

func (*Release) MetaPath added in v0.4.0

func (rel *Release) MetaPath() string

MetaPath returns the meta file path within the release. eg. [`<host>/<user>/<project>/<timestamp>/meta.yml`]

func (*Release) Name added in v0.3.0

func (rel *Release) Name() string

Name returns the `<host>/<user>/<project>`.

func (*Release) Prefix added in v0.4.0

func (rel *Release) Prefix() string

Prefix returns the `<host>/<user>/<project>/<timestamp>/`.

func (*Release) Timestamp added in v0.3.0

func (rel *Release) Timestamp() string

Timestamp returns the timestamp.

Jump to

Keyboard shortcuts

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