download

package
v0.0.0-...-17625c3 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2017 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// Dir maps a remote repo to a directory.
	Dir(remote string, f func(dir string) error) error
	// Clear removes all cached packages from disk.
	Clear() error
}

Cache provides a space for downloading packages.

var NoCache Cache = tempDir{}

NoCache is a cache implementation that doesn't cache anything.

func NewCache

func NewCache(dir string) Cache

NewCache returns a repo for a cache.

type Lock

type Lock struct {
	Import []LockPackage `json:"import"`
}

Lock is the lock file serialization format.

type LockPackage

type LockPackage struct {
	Package     string   `json:"name"`
	Version     string   `json:"version"`
	Remote      string   `json:"remote,omitempty"`
	Subpackages []string `json:"subpackage,omitempty"`
}

LockPackage is the lock file serialization of a package.

type Manifest

type Manifest struct {
	Import []ManifestPackage `json:"import,omitempty"`
}

Manifest is the manifest file serialization format.

type ManifestPackage

type ManifestPackage struct {
	Package     string   `json:"package"`
	Version     string   `json:"version"`
	Remote      string   `json:"remote,omitempty"`
	Subpackages []string `json:"subpackages,omitempty"`
}

ManifestPackage is the manifest file serialization of a package.

type Project

type Project struct {
	// Directory to operate in.
	Dir string

	Cache Cache
}

Project can be used to manage manifest and lock files.

func (*Project) Download

func (p *Project) Download(pkg ManifestPackage) (LockPackage, error)

Download downloads a package to the vendor directory of a project. It does not modify the lock files.

func (*Project) Import

func (p *Project) Import(m *Manifest) error

Import sets the manifest file. It must not already exist.

func (*Project) LoadLock

func (p *Project) LoadLock() (*Lock, error)

LoadLock reads and parses the project's lock file. If it doesn't exist, an empty lock file is returned.

func (*Project) LoadManifest

func (p *Project) LoadManifest() (*Manifest, error)

LoadManifest reads and parses the project's manifest file.

func (*Project) Remove

func (p *Project) Remove(importPath string) error

Remove deletes a package from the vendor directory of a project.

func (*Project) UpdateLock

func (p *Project) UpdateLock(f func(l *Lock) error) error

UpdateLock reads the lock file, appies the passed function, then writes the result.

Jump to

Keyboard shortcuts

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