pkg

package
v0.0.0-...-4d61859 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const RegistryFile = "~/.config/jsonnet-bundler/registries.yaml"

Variables

View Source
var GitQuiet = false
View Source
var (
	VersionMismatch = errors.New("multiple colliding versions specified")
)

Functions

func CleanLegacyName

func CleanLegacyName(list map[string]deps.Dependency)

func Ensure

func Ensure(direct v1.JsonnetFile, vendorDir string, oldLocks map[string]deps.Dependency) (map[string]deps.Dependency, error)

Ensure receives all direct packages, the directory to vendor into and all known locks. It then makes sure all direct and nested dependencies are present in vendor at the correct version:

If the package is locked and the files in vendor match the sha256 checksum, nothing needs to be done. Otherwise, the package is retrieved from the upstream source and added into vendor. If previously locked, the sums are checked as well. In case a (nested) package is already present in the lock, the one from the lock takes precedence. This allows the user to set the desired version in case by `jb install`ing it.

Finally, all unknown files and directories are removed from vendor/ The full list of locked depedencies is returned

func LoadRegistries

func LoadRegistries() error

func PrintHeader

func PrintHeader(writer io.Writer, headers []string)

func PrintRow

func PrintRow(writer io.Writer, line []string)

func SearchPackage

func SearchPackage(ctx context.Context, query string) (map[string][]Package, error)

func UpdateRegistries

func UpdateRegistries(ctx context.Context) error

Types

type GitPackage

type GitPackage struct {
	Source *deps.Git
}

func (*GitPackage) Install

func (p *GitPackage) Install(ctx context.Context, name, dir, version string) (string, error)

type GitRegistry

type GitRegistry struct {
	Name        string `yaml:"name"`
	Description string `yaml:"description"`
	Source      string `yaml:"source"`
	PackageFile string `yaml:"filename"`
}

GitRegistry implements the Registry interface and supports registries in git

func NewGitRegistry

func NewGitRegistry(name, description, source, packageFile string) *GitRegistry

NewGitRegistry creates an instance of GitRegistry

func (GitRegistry) CleanCache

func (r GitRegistry) CleanCache() error

func (GitRegistry) Init

func (r GitRegistry) Init(ctx context.Context) error

func (GitRegistry) Search

func (r GitRegistry) Search(ctx context.Context, query string) ([]Package, error)

Search queries the data for some text

func (GitRegistry) Update

func (r GitRegistry) Update(ctx context.Context) error

Update to latest version

type Interface

type Interface interface {
	Install(ctx context.Context, name, dir, version string) (lockVersion string, err error)
}

func NewGitPackage

func NewGitPackage(source *deps.Git) Interface

func NewLocalPackage

func NewLocalPackage(source *deps.Local) Interface

type LocalPackage

type LocalPackage struct {
	Source *deps.Local
}

func (*LocalPackage) Install

func (p *LocalPackage) Install(ctx context.Context, name, dir, version string) (lockVersion string, err error)

type Package

type Package struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Source      string   `json:"source"`
	Versions    Versions `json:"versions"`
}

Package describes a package referenced in a registry

type RegistryConfig

type RegistryConfig struct {
	// Dir is the path where the registry config(s) are stored
	Entries []GitRegistry `yaml:"registries"`
}
var Registries *RegistryConfig

func DefaultConfig

func DefaultConfig() *RegistryConfig

func (RegistryConfig) SaveRegistries

func (c RegistryConfig) SaveRegistries() error

type Version

type Version struct {
	Version string `json:"version"`
	Source  string `json:"source"`
}

Version describes a specific version of a package

type Versions

type Versions []Version

func (Versions) Len

func (v Versions) Len() int

func (Versions) Less

func (v Versions) Less(i, j int) bool

func (Versions) Swap

func (v Versions) Swap(i, j int)

Swap swaps the elements with indexes i and j.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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