jsonnetmod

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadModInfo

func LoadModInfo(m *Mod) error

func NewImporter

func NewImporter(ctx context.Context, resolver Resolver) jsonnet.Importer

func WithOpts

func WithOpts(ctx context.Context, fns ...OptFn) context.Context

func WriteMod

func WriteMod(m *Mod) error

Types

type ImportPath

type ImportPath struct {
	*Mod
	SubPath string
}

func ImportPathFor

func ImportPathFor(mod *Mod, importPath string) *ImportPath

func (*ImportPath) FullPath

func (i *ImportPath) FullPath() string

type Importer

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

func (*Importer) Import

func (i *Importer) Import(importedFrom, importedPath string) (jsonnet.Contents, string, error)

type Mod

type Mod struct {
	// Module name
	Module string `json:",omitempty"`
	// JPath JSONNET_PATH
	// when not empty, symlinks will be created for JSONNET_PATH
	JPath string `json:",omitempty"`
	// Replace
	// version limit
	Replace map[PathReplace]PathReplace `json:",omitempty"`
	// Require same as go root
	// require { module: version }
	// indirect require { module:: version }
	Require map[string]Require `json:",omitempty"`

	// Version
	Version string `json:"-"`
	// Dir
	Dir string `json:"-"`
	// Sum
	Sum string `json:"-"`
}

func ModFromDir

func ModFromDir(dir string) (*Mod, error)

func (*Mod) Clone

func (m *Mod) Clone() *Mod

func (*Mod) ResolveImportPath

func (m *Mod) ResolveImportPath(ctx context.Context, cache *ModCache, importPath string, version string) (*ImportPath, error)

func (*Mod) Resolved

func (m *Mod) Resolved() bool

func (*Mod) SetRequire

func (m *Mod) SetRequire(module string, version string, indirect bool)

type ModCache

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

func NewModCache

func NewModCache() *ModCache

func (*ModCache) Get

func (c *ModCache) Get(ctx context.Context, importPath string, version string, fixVersion VersionFixer) (*Mod, error)

func (*ModCache) LookupReplace

func (c *ModCache) LookupReplace(importPath string, version string) (matched PathReplace, replace PathReplace, exists bool)

func (*ModCache) ModuleVersion

func (c *ModCache) ModuleVersion(repo string) (version string)

func (*ModCache) Set

func (c *ModCache) Set(mod *Mod)

func (*ModCache) SetModuleVersion

func (c *ModCache) SetModuleVersion(module string, version string)

type OptFn

type OptFn = func(o *Opts)

func OptUpgrade

func OptUpgrade(b bool) OptFn

type Opts

type Opts struct {
	Upgrade bool `name:"upgrade,u" usage:"need upgrade dependencies"`
}

func OptsFromContext

func OptsFromContext(ctx context.Context) Opts

type PathReplace

type PathReplace struct {
	Version string
	Path    string
}

func ParsePathIdentity

func ParsePathIdentity(v string) (*PathReplace, error)

func (PathReplace) IsLocalReplace

func (r PathReplace) IsLocalReplace() bool

func (PathReplace) MarshalText

func (r PathReplace) MarshalText() (text []byte, err error)

func (PathReplace) String

func (r PathReplace) String() string

func (*PathReplace) UnmarshalText

func (r *PathReplace) UnmarshalText(text []byte) error

type Require

type Require struct {
	Version  string
	Indirect bool `json:",omitempty"`
}

type Resolver

type Resolver interface {
	Resolve(ctx context.Context, importPath string, importedFrom string) (fullDir string, err error)
}

type VMod

type VMod struct {
	*Mod
	// contains filtered or unexported fields
}

func VModFor

func VModFor(root string) *VMod

func (*VMod) Get

func (v *VMod) Get(ctx context.Context, i string) error

func (*VMod) ListJsonnet

func (v *VMod) ListJsonnet(fromPath string) ([]string, error)

func (*VMod) MakeVM

func (v *VMod) MakeVM(ctx context.Context) *jsonnet.VM

func (*VMod) Resolve

func (v *VMod) Resolve(ctx context.Context, importPath string, importedFrom string) (string, error)

func (*VMod) SetRequireFromImportPath

func (v *VMod) SetRequireFromImportPath(p *ImportPath, indirect bool) error

type VersionFixer

type VersionFixer = func(repo string, version string) string

Jump to

Keyboard shortcuts

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