librariesmanager

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	*LibrariesManager
}

Builder is used to create a new LibrariesManager. The builder has methods to load and parse libraries and to actually build the LibraryManager. Once the LibrariesManager is built, it cannot be altered anymore.

func NewBuilder

func NewBuilder() *Builder

NewBuilder creates a new library manager builder.

func (*Builder) AddLibrariesDir

func (lmb *Builder) AddLibrariesDir(libDir LibrariesDir)

AddLibrariesDir adds path to the list of directories to scan when searching for libraries. If a path is already in the list it is ignored.

func (*Builder) Build

func (lmb *Builder) Build() (*LibrariesManager, []*status.Status)

Build builds a new LibrariesManager.

func (*Builder) BuildIntoExistingLibrariesManager

func (lmb *Builder) BuildIntoExistingLibrariesManager(old *LibrariesManager)

BuildIntoExistingLibrariesManager will overwrite the given LibrariesManager instead of building a new one.

type Explorer

type Explorer struct {
	*LibrariesManager
}

Explorer is used to query the library manager about the installed libraries.

func (*Explorer) Names

func (lm *Explorer) Names() []string

Names returns an array with all the names of the installed libraries.

type Installer

type Installer struct {
	*LibrariesManager
}

Installer is used to rescan installed libraries after install/uninstall.

func (*Installer) FindByReference

func (lmi *Installer) FindByReference(name string, version *semver.Version, installLocation libraries.LibraryLocation) libraries.List

FindByReference return the installed libraries matching the Reference name and version or, if the version is nil, the libraries installed in the installLocation.

func (*Installer) InstallGitLib

func (lmi *Installer) InstallGitLib(gitURL string, overwrite bool) error

InstallGitLib installs a library hosted on a git repository on the specified path.

func (*Installer) InstallPrerequisiteCheck

func (lmi *Installer) InstallPrerequisiteCheck(name string, version *semver.Version, installLocation libraries.LibraryLocation) (*LibraryInstallPlan, error)

InstallPrerequisiteCheck performs prequisite checks to install a library. It returns the install path, where the library should be installed and the possible library that is already installed on the same folder and it's going to be replaced by the new one.

func (*Installer) InstallZipLib

func (lmi *Installer) InstallZipLib(ctx context.Context, archivePath *paths.Path, overwrite bool) error

InstallZipLib installs a Zip library on the specified path.

func (*Installer) RescanLibraries

func (lmi *Installer) RescanLibraries() []*status.Status

RescanLibraries reload all installed libraries in the system.

func (*Installer) Uninstall

func (lmi *Installer) Uninstall(lib *libraries.Library) error

Uninstall removes a Library

type LibrariesDir

type LibrariesDir struct {
	Path            *paths.Path
	Location        libraries.LibraryLocation
	PlatformRelease *cores.PlatformRelease
	IsSingleLibrary bool // true if Path points directly to a library instad of a dir of libraries
	// contains filtered or unexported fields
}

LibrariesDir is a directory containing libraries

type LibrariesManager

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

LibrariesManager keeps the current status of the libraries in the system (the list of libraries, revisions, installed paths, etc.)

func (*LibrariesManager) Clone

func (lm *LibrariesManager) Clone() *Builder

Clone creates a Builder starting with a copy of the same configuration of this LibrariesManager. At the moment of the Build() only the added libraries directories will be scanned, keeping the existing directories "cached" to optimize scan. If you need to do a full rescan you must use the RescanLibraries method of the Installer.

func (*LibrariesManager) FindAllInstalled

func (lm *LibrariesManager) FindAllInstalled() libraries.List

FindAllInstalled returns all the installed libraries

func (*LibrariesManager) NewExplorer

func (lm *LibrariesManager) NewExplorer() (*Explorer, func())

NewExplorer returns a new Explorer. The returned function must be called to release the lock on the LibrariesManager.

func (*LibrariesManager) NewInstaller

func (lm *LibrariesManager) NewInstaller() (*Installer, func())

NewInstaller returns a new Installer. The returned function must be called to release the lock on the LibrariesManager.

type LibraryInstallPlan

type LibraryInstallPlan struct {
	// Name of the library to install
	Name string

	// Version of the library to install
	Version *semver.Version

	// TargetPath is the path where the library should be installed.
	TargetPath *paths.Path

	// ReplacedLib is the library that is going to be replaced by the new one.
	ReplacedLib *libraries.Library

	// UpToDate is true if the library to install has the same version of the library we are going to replace.
	UpToDate bool
}

LibraryInstallPlan contains the main information required to perform a library install, like the path where the library should be installed and the library that is going to be replaced by the new one. This is the result of a call to InstallPrerequisiteCheck.

Jump to

Keyboard shortcuts

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