domain

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2024 License: MIT Imports: 12 Imported by: 0

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

View Source
const (
	TAR_GZ  = "tar.gz"
	ZIP     = "zip"
	DMG     = "dmg"
	RAW     = "raw"
	UNKNOWN = "unknown"
)
View Source
const VarNameSvmSoftDir = "SVM_SOFT_DIR"
View Source
const VarNameSvmSoftPackageDirTemplate = "SVM_SOFT_%v_DIR"

Variables

This section is empty.

Functions

func CompareAsc

func CompareAsc(v1, v2 Version) bool

func CompareDesc

func CompareDesc(v1, v2 Version) bool

func Register added in v0.9.0

func Register(plugin Plugin)

func ValidateVersion

func ValidateVersion(version string) error

Types

type Asset added in v0.9.0

type Asset struct {
	Version         string
	Name            string
	Url             string
	Type            Type
	ExtraProperties map[string]string
}

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 FetchedPackage struct {
	Version  Version
	FilePath string
	Type     Type
}

type InstalledPackage

type InstalledPackage struct {
	Version     Version
	Path        string
	InstalledOn int64
	Main        bool
}

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 GetPlugin added in v0.9.0

func GetPlugin(name string) Plugin

func GetPlugins added in v0.9.0

func GetPlugins() []Plugin

type Type

type Type string

type Version

type Version struct {
	Value string
	// contains filtered or unexported fields
}

func FindVersion

func FindVersion(version string, versions []string) (Version, int, error)

func NewVersion

func NewVersion(version string) (Version, error)

func Ver added in v0.9.0

func Ver(version string, t *testing.T) Version

func (Version) Major

func (version Version) Major() int

func (Version) Minor

func (version Version) Minor() int

type VersionGranularity added in v0.9.0

type VersionGranularity string
const (
	VersionGranularityMajor VersionGranularity = "MAJOR"
	VersionGranularityMinor VersionGranularity = "MINOR"
)

Jump to

Keyboard shortcuts

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