versionmap

package
v2.0.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const WorkspaceLockStructVersion = 20240429

Variables

This section is empty.

Functions

This section is empty.

Types

type DependencyVersionListMap

type DependencyVersionListMap map[string]modconfig.DependencyVersionList

DependencyVersionListMap is a map keyed by dependency name storing a list of versions for each dependency

func (DependencyVersionListMap) Add

func (DependencyVersionListMap) FlatMap

func (m DependencyVersionListMap) FlatMap() map[string]struct{}

FlatMap converts the DependencyVersionListMap map into a lookup keyed by qualified dependency name

type InstalledDependencyVersionsMap

type InstalledDependencyVersionsMap map[string]map[string]*InstalledModVersion

InstalledDependencyVersionsMap is a map of parent names to a map of dependencies for that parent, keyed by dependency name

func (InstalledDependencyVersionsMap) AddDependency

func (m InstalledDependencyVersionsMap) AddDependency(parentName string, dependency *InstalledModVersion)

AddDependency adds a dependency to the list of items installed for the given parent

func (InstalledDependencyVersionsMap) FlatMap

FlatMap converts the InstalledDependencyVersionsMap into a map[string]*InstalledModVersion, keyed by mod dependency path

func (InstalledDependencyVersionsMap) GetDependencyTree

func (m InstalledDependencyVersionsMap) GetDependencyTree(rootName string, lock *WorkspaceLock) treeprint.Tree

func (InstalledDependencyVersionsMap) GetDowngradedInOther

func (InstalledDependencyVersionsMap) GetMissingFromOther

GetMissingFromOther returns a map of dependencies which exit in this map but not 'other'

func (InstalledDependencyVersionsMap) GetUpgradedInOther

type InstalledModVersion

type InstalledModVersion struct {
	*ResolvedVersionConstraint
	Alias string `json:"alias"`
}

InstalledModVersion is a struct to represent a version of a mod which has been installed

func (InstalledModVersion) SatisfiesConstraint

func (v InstalledModVersion) SatisfiesConstraint(requiredVersion *modconfig.ModVersionConstraint) bool

type ResolvedVersionConstraint

type ResolvedVersionConstraint struct {
	modconfig.DependencyVersion
	Name string `json:"name,omitempty"`

	Commit        string `json:"commit,omitempty"`
	GitRefStr     string `json:"git_ref,omitempty"`
	StructVersion int    `json:"struct_version,omitempty"`
}

ResolvedVersionConstraint is a struct to represent a version constraint which has been resolved to specific version (either a git tag, git commit (for a branch constraint) or a file location)

func NewResolvedVersionConstraint

func NewResolvedVersionConstraint(version *modconfig.DependencyVersion, name string, gitRef *plumbing.Reference) *ResolvedVersionConstraint

func (ResolvedVersionConstraint) DependencyPath

func (c ResolvedVersionConstraint) DependencyPath() string

func (ResolvedVersionConstraint) Equals

func (ResolvedVersionConstraint) IsPrerelease

func (c ResolvedVersionConstraint) IsPrerelease() bool

type ResolvedVersionConstraintList

type ResolvedVersionConstraintList []*ResolvedVersionConstraint

func (ResolvedVersionConstraintList) Len

Len returns the length of a collection. The number of Version instances on the slice.

func (ResolvedVersionConstraintList) Less

func (c ResolvedVersionConstraintList) Less(i, j int) bool

Less is needed for the sort interface to compare two Version objects on the slice. If checks if one is less than the other.

func (ResolvedVersionConstraintList) Swap

func (c ResolvedVersionConstraintList) Swap(i, j int)

Swap is needed for the sort interface to replace the Version objects at two different positions in the slice.

type ResolvedVersionConstraintListMap

type ResolvedVersionConstraintListMap map[string]ResolvedVersionConstraintList

type ResolvedVersionListMap

type ResolvedVersionListMap map[string][]*InstalledModVersion

ResolvedVersionListMap represents a map of ResolvedVersionConstraint arrays, keyed by dependency name

func (ResolvedVersionListMap) Add

func (m ResolvedVersionListMap) Add(name string, versionConstraint *InstalledModVersion)

Add appends the version constraint to the list for the given name

func (ResolvedVersionListMap) FlatMap

FlatMap converts the ResolvedVersionListMap map into a map keyed by the FULL dependency name (i.e. including version(

func (ResolvedVersionListMap) FlatNames

func (m ResolvedVersionListMap) FlatNames() []string

FlatNames converts the ResolvedVersionListMap map into a string array of full names

func (ResolvedVersionListMap) Remove

func (m ResolvedVersionListMap) Remove(name string, constraint *ResolvedVersionConstraint)

Remove removes the given version constraint from the list for the given name

type VersionMap

type VersionMap map[string]*semver.Version

VersionMap represents a map of semver versions, keyed by dependency name

type WorkspaceLock

type WorkspaceLock struct {
	WorkspacePath   string
	InstallCache    InstalledDependencyVersionsMap
	MissingVersions InstalledDependencyVersionsMap

	ModInstallationPath string
	// contains filtered or unexported fields
}

WorkspaceLock is a map of ModVersionMaps items keyed by the parent mod whose dependencies are installed

func EmptyWorkspaceLock

func EmptyWorkspaceLock(existingLock *WorkspaceLock) *WorkspaceLock

EmptyWorkspaceLock creates a new empty workspace lock based, sharing workspace path and installedMods with 'existingLock'

func LoadWorkspaceLock

func LoadWorkspaceLock(workspacePath string) (*WorkspaceLock, error)

func (*WorkspaceLock) ContainsModVersion

func (l *WorkspaceLock) ContainsModVersion(modName string, modVersion *modconfig.DependencyVersion) bool

ContainsModVersion returns whether the lockfile contains the given mod version

func (*WorkspaceLock) Delete

func (l *WorkspaceLock) Delete() error

Delete deletes the lock file

func (*WorkspaceLock) DeleteMods

func (l *WorkspaceLock) DeleteMods(mods map[string]*modconfig.ModVersionConstraint, parent *modconfig.Mod)

DeleteMods removes mods from the lock file then, if it is empty, deletes the file

func (*WorkspaceLock) Empty

func (l *WorkspaceLock) Empty() bool

Empty returns whether the install cache is empty

func (*WorkspaceLock) EnsureLockedModVersion

func (l *WorkspaceLock) EnsureLockedModVersion(requiredModVersion *modconfig.ModVersionConstraint, parent *modconfig.Mod) (*InstalledModVersion, error)

EnsureLockedModVersion looks for a lock file entry matching the required mod name

func (*WorkspaceLock) FindInstalledDependency

func (l *WorkspaceLock) FindInstalledDependency(modDependency *ResolvedVersionConstraint) (string, error)

func (*WorkspaceLock) FindLockedModVersion

func (l *WorkspaceLock) FindLockedModVersion(requiredModVersion *modconfig.ModVersionConstraint) (*InstalledModVersion, error)

FindLockedModVersion looks for a lock file entry matching the required constraint and returns nil if not found

func (*WorkspaceLock) FindMod

func (l *WorkspaceLock) FindMod(dependencyName string) []*InstalledModVersion

FindMod looks for a lock file entry matching the given mod dependency name for any parent

func (*WorkspaceLock) GetLockedModVersion

func (l *WorkspaceLock) GetLockedModVersion(requiredModVersion *modconfig.ModVersionConstraint, parent *modconfig.Mod) (*InstalledModVersion, error)

GetLockedModVersion looks for a lock file entry for the given parent matching the required constraint and returns nil if not found

func (*WorkspaceLock) GetLockedModVersionConstraint

func (l *WorkspaceLock) GetLockedModVersionConstraint(requiredModVersion *modconfig.ModVersionConstraint, parent *modconfig.Mod) (*modconfig.ModVersionConstraint, error)

GetLockedModVersionConstraint looks for a lock file entry matching the required mod version and if found, returns it in the form of a ModVersionConstraint

func (*WorkspaceLock) GetLockedModVersions

func (l *WorkspaceLock) GetLockedModVersions(mods map[string]*modconfig.ModVersionConstraint, parent *modconfig.Mod) (ResolvedVersionListMap, error)

GetLockedModVersions builds a ResolvedVersionListMap with the resolved versions for each item of the given versionConstraintMap found in the lock file

func (*WorkspaceLock) GetMod

func (l *WorkspaceLock) GetMod(modDependencyName string, parent *modconfig.Mod) *InstalledModVersion

GetMod looks for a lock file entry matching the given mod dependency name (e.g.github.com/turbot/steampipe-mod-azure-thrifty

func (*WorkspaceLock) GetModList

func (l *WorkspaceLock) GetModList(rootName string) string

func (*WorkspaceLock) GetUnreferencedMods

func (l *WorkspaceLock) GetUnreferencedMods() DependencyVersionListMap

GetUnreferencedMods returns a map of all installed mods which are not in the lock file

func (*WorkspaceLock) Incomplete

func (l *WorkspaceLock) Incomplete() bool

Incomplete returned whether there are any missing dependencies (i.e. they exist in the lock file but ate not installed)

func (*WorkspaceLock) Save

func (l *WorkspaceLock) Save() error

func (*WorkspaceLock) StructVersion

func (l *WorkspaceLock) StructVersion() int

StructVersion returns the struct version of the workspace lock because only the InstallCache is serialised, read the StructVersion from the first install cache entry

Jump to

Keyboard shortcuts

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