Documentation ¶
Overview ¶
* Copyright © 2024 Piotr Kozak <[email protected]> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE.
* Copyright © 2024 Piotr Kozak <[email protected]> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE.
* Copyright © 2024 Piotr Kozak <[email protected]> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE.
* Copyright © 2024 Piotr Kozak <[email protected]> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE.
* Copyright © 2024 Piotr Kozak <[email protected]> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE.
Index ¶
- Constants
- func CompareAsc(v1, v2 Version) bool
- func CompareDesc(v1, v2 Version) bool
- func Register(plugin Plugin)
- func ValidateVersion(version string) error
- type Asset
- type EnvVariable
- type EnvVariables
- type ExtractStrategy
- type FetchedPackage
- type InstalledPackage
- type InstalledPackages
- func (installedPackages *InstalledPackages) Add(installedPackage InstalledPackage)
- func (installedPackages *InstalledPackages) FoundMain() (*InstalledPackage, error)
- func (installedPackages *InstalledPackages) IsInstalled(version Version) bool
- func (installedPackages *InstalledPackages) PrepareEnvVariables(plugin Plugin) (EnvVariables, error)
- func (installedPackages *InstalledPackages) RemoveByVersion(version Version) *InstalledPackage
- func (installedPackages *InstalledPackages) SerializeInstalledPackages() (string, error)
- type Plugin
- type Type
- type Version
- type VersionGranularity
Constants ¶
const ( TAR_GZ = "tar.gz" ZIP = "zip" DMG = "dmg" RAW = "raw" UNKNOWN = "unknown" )
const VarNameSvmSoftDir = "SVM_SOFT_DIR"
const VarNameSvmSoftPackageDirTemplate = "SVM_SOFT_%v_DIR"
Variables ¶
This section is empty.
Functions ¶
func CompareAsc ¶
func CompareDesc ¶
func ValidateVersion ¶
Types ¶
type EnvVariable ¶ added in v0.9.0
type EnvVariable struct { Name string PrefixVariable *EnvVariable SuffixValue string }
func (EnvVariable) ToEnv ¶ added in v0.9.0
func (v EnvVariable) ToEnv() string
func (EnvVariable) ToExport ¶ added in v0.9.0
func (v EnvVariable) ToExport() string
type EnvVariables ¶ added in v0.9.0
type EnvVariables struct { Variables []EnvVariable MainVariable *EnvVariable ExecutableRelativePath string }
func (EnvVariables) Resolve ¶ added in v0.9.0
func (envVariables EnvVariables) Resolve(extraEnvVariables []EnvVariable) (EnvVariables, error)
func (EnvVariables) ToExport ¶ added in v0.9.0
func (envVariables EnvVariables) ToExport() []string
type ExtractStrategy ¶ added in v0.9.0
type ExtractStrategy string
const ( // UseCompressedDirOrArchiveName - if archive contains only one top level directory, it will be used as target directory, // otherwise archive name without extension will be used UseCompressedDirOrArchiveName ExtractStrategy = "default" // ReplaceCompressedDirWithArchiveName - archive name without extension will be used as target directory, // and it will replace archive top level directory if there is only one ReplaceCompressedDirWithArchiveName ExtractStrategy = "archive_replace" )
how to extract archive
type FetchedPackage ¶
type InstalledPackage ¶
func (*InstalledPackage) RoundVersion ¶ added in v0.9.0
func (ip *InstalledPackage) RoundVersion(versionGranularity VersionGranularity) (Version, error)
type InstalledPackages ¶ added in v0.9.0
type InstalledPackages struct { Plugin Plugin Items []InstalledPackage }
func DeserializeInstalledPackages ¶ added in v0.9.0
func DeserializeInstalledPackages(name, serialized string) (InstalledPackages, error)
func (*InstalledPackages) Add ¶ added in v0.9.0
func (installedPackages *InstalledPackages) Add(installedPackage InstalledPackage)
func (*InstalledPackages) FoundMain ¶ added in v0.9.0
func (installedPackages *InstalledPackages) FoundMain() (*InstalledPackage, error)
func (*InstalledPackages) IsInstalled ¶ added in v0.9.0
func (installedPackages *InstalledPackages) IsInstalled(version Version) bool
func (*InstalledPackages) PrepareEnvVariables ¶ added in v0.9.0
func (installedPackages *InstalledPackages) PrepareEnvVariables(plugin Plugin) (EnvVariables, error)
func (*InstalledPackages) RemoveByVersion ¶ added in v0.9.0
func (installedPackages *InstalledPackages) RemoveByVersion(version Version) *InstalledPackage
func (*InstalledPackages) SerializeInstalledPackages ¶ added in v0.9.0
func (installedPackages *InstalledPackages) SerializeInstalledPackages() (string, error)
type Plugin ¶ added in v0.9.0
type Plugin struct { Name string EnvNamePrefix string ExecutableRelativePath string VersionGranularity VersionGranularity ExtractStrategy ExtractStrategy RawExecutableName string CalculateDownloadUrl func(version Version, os, arch string) (string, Type) CalculateDownloadedFileName func(asset Asset) string PostInstall func(installedPackage InstalledPackage) error PostUninstall func(version Version) error VerifyChecksum func(asset Asset, fetchedPackage FetchedPackage) error GetAvailableAssets func() ([]Asset, error) }
func GetPlugins ¶ added in v0.9.0
func GetPlugins() []Plugin
type Version ¶
type Version struct { Value string // contains filtered or unexported fields }
func NewVersion ¶
type VersionGranularity ¶ added in v0.9.0
type VersionGranularity string
const ( VersionGranularityMajor VersionGranularity = "MAJOR" VersionGranularityMinor VersionGranularity = "MINOR" )