spec

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidVersion is returned when the requested YPKG format is unsupported
	ErrInvalidVersion = errors.New("invalid ypkg version specified")
)

Functions

func DetectFormat

func DetectFormat(path string) (ypkg int, err error)

DetectFormat reads a package.yml to check for the version of the format

Types

type Package

type Package interface {
	// Load populates a PackageYML version by reading in the contents from a specific filepath
	Load(path string, mode int) error
	// Convert turns a versioned PackageYML into the intermediate internal.PackageYML representation
	Convert() (*internal.PackageYML, error)
	// Modify a versioned PackageYML with the contents of an internal.PackageYML
	Modify(changes internal.PackageYML) error
	// File returns the underlying file record
	File() *os.File
	// Save writes any changes to this PackageSpec to the currently open file descriptor
	Save() error
	// Close close the file descriptor for this PackageSpec
	Close()
}

Package is a common interface to all version of the Package YML specification

func Auto

func Auto(sources []string) (pkg Package, err error)

Auto generates a new package my inspecting the contents of a list of sources

func Bump

func Bump(path string) (pkg Package, err error)

Bump increments the release number of a package.yml

func Convert

func Convert(path string, ypkg int) (pkg Package, err error)

Convert a package.yml from any version to another

func Init

func Init(path string) (pkg Package, err error)

Init creates a new package.yml with the required field pre-populated like a template

func Lint

func Lint(path string) (pkg Package, err error)

Lint checks for errors and common mistakes in package.yml

func Load

func Load(path string) (pkg Package, err error)

Load reads in any supported package.yml from file

func NewPackage

func NewPackage(ypkg int, f *os.File) (pkg Package, err error)

NewPackage creates and empty package of the specified version, if supported

func Update

func Update(path, version string, sources []string) (pkg Package, err error)

Update modifies the sources in an existing package.yml and overwrites the existing file

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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