installation

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: MIT Imports: 22 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIsAlreadyInstalled = errors.New("can't install, the newest version is already installed")
	ErrIsNotInstalled     = errors.New("plugin is not installed")
	ErrIsAlreadyUpgraded  = errors.New("can't upgrade, the newest version is already installed")
)

Plugin lifecycle errors

Functions

func CleanupStaleSrewInstallations

func CleanupStaleSrewInstallations(dir, currentVersion string) error

CleanupStaleSrewInstallations removes the versions that aren't the current version.

func DisplayName

func DisplayName(p index.Plugin) string

func DisplayVersion

func DisplayVersion(p index.Plugin) string

func GetInstalledPluginReceipts

func GetInstalledPluginReceipts(receiptsDir string) ([]index.Receipt, error)

GetInstalledPluginReceipts returns a list of receipts.

func GetMatchingPlatform

func GetMatchingPlatform(platforms []index.Platform) (index.Platform, bool, error)

GetMatchingPlatform finds the platform spec in the specified plugin that matches the os/arch of the current machine (can be overridden via SREW_OS and/or SREW_ARCH).

func Install

func Install(p environment.Paths, plugin index.Plugin, opts InstallOpts) error

Install will download and install a plugin. The operation tries to not get the plugin dir in a bad state if it fails during the process.

func InstalledPluginsFromIndex

func InstalledPluginsFromIndex(receiptsDir, indexName string) ([]index.Receipt, error)

InstalledPluginsFromIndex returns a list of all install plugins from a particular index.

func IsBinDirInPATH

func IsBinDirInPATH(paths environment.Paths) bool

func IsWindows

func IsWindows() bool

IsWindows sees if SREW_OS or runtime.GOOS to find out if current execution mode is win32.

func PrintWarning

func PrintWarning(w io.Writer, format string, a ...interface{})

func SetupInstructions

func SetupInstructions() string

func SortByFirstColumn

func SortByFirstColumn(rows [][]string) [][]string

func ToPlatforms

func ToPlatforms(s []string) ([]index.Platform, error)

func ToPlugin

func ToPlugin(m []model.Detail) index.Plugin

func ToPluginDetail

func ToPluginDetail(m map[string]interface{}) error

func Uninstall

func Uninstall(p environment.Paths, name string) error

Uninstall will uninstall a plugin.

func Upgrade

func Upgrade(p environment.Paths, plugin index.Plugin) error

Upgrade will reinstall and delete the old plugin. The operation tries to not get the plugin dir in a bad state if it fails during the process.

Types

type InstallOpts

type InstallOpts struct {
	ArchiveFileOverride string
}

InstallOpts specifies options for plugin installation operation.

type OSArchPair

type OSArchPair struct {
	OS, Arch string
}

OSArchPair is wrapper around operating system and architecture

func OSArch

func OSArch() OSArchPair

OSArch returns the OS/arch combination to be used on the current system. It can be overridden by setting SREW_OS and/or SREW_ARCH environment variables.

func (OSArchPair) String

func (p OSArchPair) String() string

String converts environment into a string

Directories

Path Synopsis
todo(corneliusweig) remove migration code with v0.4
todo(corneliusweig) remove migration code with v0.4
Package semver is a wrapper for handling of semantic version (https://semver.org) values.
Package semver is a wrapper for handling of semantic version (https://semver.org) values.
Package validation implements functions to validate Srew plugin types.
Package validation implements functions to validate Srew plugin types.

Jump to

Keyboard shortcuts

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