librariesmanager

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LibraryIndexGZURL, _ = url.Parse("https://downloads.arduino.cc/libraries/library_index.json.gz")

LibraryIndexGZURL is the URL where to get the gzipped library index.

View Source
var LibraryIndexSignature, _ = url.Parse("https://downloads.arduino.cc/libraries/library_index.json.sig")

LibraryIndexSignature is the URL where to get the library index signature.

View Source
var LibraryIndexURL, _ = url.Parse("https://downloads.arduino.cc/libraries/library_index.json")

LibraryIndexURL is the URL where to get the library index.

View Source
var LibraryIndexWithSignatureArchiveURL, _ = url.Parse("https://downloads.arduino.cc/libraries/library_index.tar.bz2")

LibraryIndexWithSignatureArchiveURL is the URL where to get the library index.

Functions

This section is empty.

Types

type LibrariesDir

type LibrariesDir struct {
	Path            *paths.Path
	Location        libraries.LibraryLocation
	PlatformRelease *cores.PlatformRelease
}

LibrariesDir is a directory containing libraries

type LibrariesManager

type LibrariesManager struct {
	LibrariesDir []*LibrariesDir
	Libraries    map[string]libraries.List `json:"libraries"`

	Index              *librariesindex.Index
	IndexFile          *paths.Path
	IndexFileSignature *paths.Path
	DownloadsDir       *paths.Path
}

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

func NewLibraryManager

func NewLibraryManager(indexDir *paths.Path, downloadsDir *paths.Path) *LibrariesManager

NewLibraryManager creates a new library manager

func (*LibrariesManager) AddLibrariesDir

func (lm *LibrariesManager) AddLibrariesDir(path *paths.Path, location libraries.LibraryLocation)

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 (*LibrariesManager) AddPlatformReleaseLibrariesDir

func (lm *LibrariesManager) AddPlatformReleaseLibrariesDir(plaftormRelease *cores.PlatformRelease, location libraries.LibraryLocation)

AddPlatformReleaseLibrariesDir add the libraries directory in the specified PlatformRelease to the list of directories to scan when searching for libraries.

func (*LibrariesManager) FindByReference

func (lm *LibrariesManager) FindByReference(libRef *librariesindex.Reference, 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 (*LibrariesManager) Install

func (lm *LibrariesManager) Install(indexLibrary *librariesindex.Release, installPath *paths.Path) error

Install installs a library on the specified path.

func (*LibrariesManager) InstallGitLib

func (lm *LibrariesManager) InstallGitLib(gitURL string, overwrite bool) error

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

func (*LibrariesManager) InstallPrerequisiteCheck

func (lm *LibrariesManager) 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 (*LibrariesManager) InstallZipLib

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

InstallZipLib installs a Zip library on the specified path.

func (*LibrariesManager) LoadIndex

func (lm *LibrariesManager) LoadIndex() error

LoadIndex reads a library_index.json from a file and returns the corresponding Index structure.

func (*LibrariesManager) LoadLibrariesFromDir

func (lm *LibrariesManager) LoadLibrariesFromDir(librariesDir *LibrariesDir) []*status.Status

LoadLibrariesFromDir loads all libraries in the given directory. Returns nil if the directory doesn't exists.

func (*LibrariesManager) LoadLibraryFromDir

func (lm *LibrariesManager) LoadLibraryFromDir(libRootDir *paths.Path, location libraries.LibraryLocation) error

LoadLibraryFromDir loads one single library from the libRootDir. libRootDir must point to the root of a valid library. An error is returned if the path doesn't exist or loading of the library fails.

func (LibrariesManager) Names

func (lm LibrariesManager) Names() []string

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

func (*LibrariesManager) RescanLibraries

func (lm *LibrariesManager) RescanLibraries() []*status.Status

RescanLibraries reload all installed libraries in the system.

func (*LibrariesManager) Uninstall

func (lm *LibrariesManager) Uninstall(lib *libraries.Library) error

Uninstall removes a Library

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