multiwerf

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AvailableChannels = []string{
	"alpha",
	"beta",
	"rc",
	"stable",
}

Functions

func CalculateSHA256

func CalculateSHA256(filePath string) (string, error)

func CheckIsFileWritable

func CheckIsFileWritable(path string) error

func CheckMajorMinor

func CheckMajorMinor(version string) error

CheckMajorMinor return error if string not in form MAJOR.MINOR

func ChooseLatestVersion

func ChooseLatestVersion(version string, channel string, availableVersions []string, availableChannels []string) (string, error)

ChooseLatestVersion returns a latest version from availableVersions that suits version and channel constrain.

version is a constrain on MAJOR and MINOR parts

channel is a constrain on Prerelease part

availableChannels is an array of prioritized Prerelease variants

func ChooseLatestVersionSimple

func ChooseLatestVersionSimple(availableVersions []string) (string, error)

ChooseLatestVersionSimple returns a latest version from availableVersions array

func ExecUpdatedBinary

func ExecUpdatedBinary(path string) error

ExecUpdatedBinary replaces current process with process from path binary --self-update=no flag is added to arguments to prevent an infinity loop.

func FileExists

func FileExists(dir string, name string) (bool, error)

func GetSelfExecutableInfo

func GetSelfExecutableInfo() (path string, err error)

GetSelfExecutableInfo return path of an executable file of current process. If file is not owned by user of the process and has no 0x400 bit — return error

func LoadHashFile

func LoadHashFile(dir string, fileName string) (hashes map[string]string)

func PrintErrorScript

func PrintErrorScript() error

func PrintUseScript

func PrintUseScript(info BinaryInfo) error

TODO Add script block to prevent from loading not in bash/zsh shells (as in rvm script)

func ReleaseFiles

func ReleaseFiles(pkg string, version string, osArch string) map[string]string

func ReplaceBinaryFile

func ReplaceBinaryFile(dir string, currentName string, newName string) (err error)

func SelfUpdate

func SelfUpdate(messages chan ActionMessage) string

func TildeExpand

func TildeExpand(path string) (string, error)

func Update

func Update(version string, channel string, args []string) error

func Use

func Use(version string, channel string, args []string) error

func VerifyReleaseFileHash

func VerifyReleaseFileHash(dir string, hashFile string, targetFile string) (bool, error)

TODO transform to VerifyFileHash — return 4 states: no hash file, no target file, not match, match

Types

type ActionMessage

type ActionMessage struct {
	// contains filtered or unexported fields
}

use and update actions send messages

type BinaryInfo

type BinaryInfo struct {
	BinaryPath string
	Version    string
}

func UpdateBinary

func UpdateBinary(version string, channel string, messages chan ActionMessage) (binInfo BinaryInfo)

1. Check for new version → print version 2. Check hashes existed binaries → print 'version stays' 3. Download and check if no binaries are existed — print 'updated to'

Jump to

Keyboard shortcuts

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