Documentation
¶
Index ¶
- Variables
- type LibrariesDir
- type LibrariesManager
- func (sc *LibrariesManager) AddLibrariesDir(path *paths.Path, location libraries.LibraryLocation)
- func (sc *LibrariesManager) AddPlatformReleaseLibrariesDir(plaftormRelease *cores.PlatformRelease, location libraries.LibraryLocation)
- func (sc *LibrariesManager) FindByReference(libRef *librariesindex.Reference) *libraries.Library
- func (lm *LibrariesManager) Install(indexLibrary *librariesindex.Release) (*paths.Path, error)
- func (sc *LibrariesManager) LoadIndex() error
- func (sc *LibrariesManager) LoadLibrariesFromDir(librariesDir *LibrariesDir) error
- func (sc LibrariesManager) Names() []string
- func (sc *LibrariesManager) RescanLibraries() error
- func (lm *LibrariesManager) Uninstall(lib *libraries.Library) error
- func (lm *LibrariesManager) UpdateIndex() (*downloader.Downloader, error)
- type LibraryAlternatives
Constants ¶
This section is empty.
Variables ¶
var LibraryIndexURL, _ = url.Parse("https://downloads.arduino.cc/libraries/library_index.json")
LibraryIndexURL is the URL where to get 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]*LibraryAlternatives `json:"libraries"` Index *librariesindex.Index IndexFile *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 (sc *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 (sc *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 (sc *LibrariesManager) FindByReference(libRef *librariesindex.Reference) *libraries.Library
FindByReference return the installed library matching the Reference name and version or, if the version is nil, the library installed in the sketchbook.
func (*LibrariesManager) Install ¶
func (lm *LibrariesManager) Install(indexLibrary *librariesindex.Release) (*paths.Path, error)
Install installs a library and returns the installed path.
func (*LibrariesManager) LoadIndex ¶
func (sc *LibrariesManager) LoadIndex() error
LoadIndex reads a library_index.json from a file and returns the corresponding Index structure.
func (*LibrariesManager) LoadLibrariesFromDir ¶
func (sc *LibrariesManager) LoadLibrariesFromDir(librariesDir *LibrariesDir) error
LoadLibrariesFromDir loads all libraries in the given directory. Returns nil if the directory doesn't exists.
func (LibrariesManager) Names ¶
func (sc LibrariesManager) Names() []string
Names returns an array with all the names of the installed libraries.
func (*LibrariesManager) RescanLibraries ¶
func (sc *LibrariesManager) RescanLibraries() error
RescanLibraries reload all installed libraries in the system.
func (*LibrariesManager) Uninstall ¶
func (lm *LibrariesManager) Uninstall(lib *libraries.Library) error
Uninstall removes a Library
func (*LibrariesManager) UpdateIndex ¶
func (lm *LibrariesManager) UpdateIndex() (*downloader.Downloader, error)
UpdateIndex downloads the libraries index file from Arduino repository.
type LibraryAlternatives ¶
LibraryAlternatives is a list of different versions of the same library installed in the system
func (*LibraryAlternatives) Add ¶
func (alts *LibraryAlternatives) Add(library *libraries.Library)
Add adds a library to the alternatives
func (*LibraryAlternatives) FindVersion ¶
func (alts *LibraryAlternatives) FindVersion(version *semver.Version) *libraries.Library
FindVersion returns the library mathching the provided version or nil if not found
func (*LibraryAlternatives) Remove ¶
func (alts *LibraryAlternatives) Remove(library *libraries.Library)
Remove removes the library from the alternatives