cfg

package
v0.0.0-...-2643b76 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package cfg handles working with the Glide configuration files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name       string       `yaml:"package"`
	Ignore     []string     `yaml:"ignore,omitempty"`
	Imports    Dependencies `yaml:"import"`
	DevImports Dependencies `yaml:"devimport,omitempty"`
}

Config is the top-level configuration object.

func ConfigFromYaml

func ConfigFromYaml(yml []byte) (*Config, error)

ConfigFromYaml returns an instance of Config from YAML

func (*Config) Clone

func (c *Config) Clone() *Config

Clone performs a deep clone of the Config instance

func (*Config) DeDupe

func (c *Config) DeDupe() error

DeDupe consolidates duplicate dependencies on a Config instance

func (*Config) HasDependency

func (c *Config) HasDependency(name string) bool

HasDependency returns true if the given name is listed as an import or dev import.

func (*Config) HasIgnore

func (c *Config) HasIgnore(name string) bool

HasIgnore returns true if the given name is listed on the ignore list.

func (*Config) Hash

func (c *Config) Hash() (string, error)

Hash generates a sha256 hash for a given Config

func (*Config) Marshal

func (c *Config) Marshal() ([]byte, error)

Marshal converts a Config instance to YAML

func (*Config) MarshalYAML

func (c *Config) MarshalYAML() (interface{}, error)

MarshalYAML is a hook for gopkg.in/yaml.v2 in the marshaling process

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is a hook for gopkg.in/yaml.v2 in the unmarshalling process

type Dependencies

type Dependencies []*Dependency

Dependencies is a collection of Dependency

func (Dependencies) Clone

func (d Dependencies) Clone() Dependencies

Clone performs a deep clone of Dependencies

func (Dependencies) DeDupe

func (d Dependencies) DeDupe() (Dependencies, error)

DeDupe cleans up duplicates on a list of dependencies.

func (Dependencies) Get

func (d Dependencies) Get(name string) *Dependency

Get a dependency by name

type Dependency

type Dependency struct {
	Name             string   `yaml:"package"`
	Reference        string   `yaml:"version,omitempty"`
	Pin              string   `yaml:"-"`
	Repository       string   `yaml:"repo,omitempty"`
	VcsType          string   `yaml:"vcs,omitempty"`
	Subpackages      []string `yaml:"subpackages,omitempty"`
	Arch             []string `yaml:"arch,omitempty"`
	Os               []string `yaml:"os,omitempty"`
	UpdateAsVendored bool     `yaml:"-"`
}

Dependency describes a package that the present package depends upon.

func (*Dependency) Clone

func (d *Dependency) Clone() *Dependency

Clone creates a clone of a Dependency

func (*Dependency) GetRepo

func (d *Dependency) GetRepo(dest string) (vcs.Repo, error)

GetRepo retrieves a Masterminds/vcs repo object configured for the root of the package being retrieved.

func (*Dependency) MarshalYAML

func (d *Dependency) MarshalYAML() (interface{}, error)

MarshalYAML is a hook for gopkg.in/yaml.v2 in the marshaling process

func (*Dependency) UnmarshalYAML

func (d *Dependency) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML is a hook for gopkg.in/yaml.v2 in the unmarshaling process

type Lock

type Lock struct {
	Name        string   `yaml:"name"`
	Version     string   `yaml:"version"`
	Repository  string   `yaml:"repo,omitempty"`
	VcsType     string   `yaml:"vcs,omitempty"`
	Subpackages []string `yaml:"subpackages,omitempty"`
	Arch        []string `yaml:"arch,omitempty"`
	Os          []string `yaml:"os,omitempty"`
}

type Lockfile

type Lockfile struct {
	Hash       string    `yaml:"hash"`
	Updated    time.Time `yaml:"updated"`
	Imports    Locks     `yaml:"imports"`
	DevImports Locks     `yaml:"devImports"`
}

Lockfile represents a glide.lock file.

func LockfileFromMap

func LockfileFromMap(ds map[string]*Dependency, hash string) *Lockfile

func LockfileFromYaml

func LockfileFromYaml(yml []byte) (*Lockfile, error)

LockfileFromYaml returns an instance of Lockfile from YAML

func NewLockfile

func NewLockfile(ds Dependencies, hash string) *Lockfile

func (*Lockfile) Marshal

func (lf *Lockfile) Marshal() ([]byte, error)

Marshal converts a Config instance to YAML

type Locks

type Locks []*Lock

func (Locks) Len

func (l Locks) Len() int

Len returns the length of the Locks. This is needed for sorting with the sort package.

func (Locks) Less

func (l Locks) Less(i, j int) bool

Less is needed for the sort interface. It compares two locks based on their name.

func (Locks) Swap

func (l Locks) Swap(i, j int)

Swap is needed for the sort interface. It swaps the position of two locks.

Jump to

Keyboard shortcuts

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