utils

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActivateVersion

func ActivateVersion(app, version string) error

ActivateVersion activates certain version

func DeleteVersion

func DeleteVersion(app, version string) error

DeleteVersion deletes version

func DownloadFile

func DownloadFile(url, filepath string) error

DownloadFile will download a url to a local file. (it will write as it downloads and not load the whole file into memory)

func DownloadVersion

func DownloadVersion(app, version string, asset *github.ReleaseAsset, d func(ms ...interface{})) (bool, error)

DownloadVersion download a version if needed. Returns (false, nil) if version is already downloaded

func FilterAsset

func FilterAsset(release *github.RepositoryRelease) *github.ReleaseAsset

FilterAsset finds an asset which is need to be downloaded

func GetActiveVersion

func GetActiveVersion(app string) (string, error)

GetActiveVersion returns active version

func GetArch

func GetArch() string

GetArch returns current arch

func GetHomeActiveDir

func GetHomeActiveDir(app string) (string, error)

GetHomeActiveDir returns home's active dir for app

func GetHomeDir

func GetHomeDir(app string) (string, error)

GetHomeDir returns home dir for app

func GetHomeTmpDir

func GetHomeTmpDir(app string) (string, error)

GetHomeTmpDir returns home's tmp dir for app

func GetHomeVersionDir

func GetHomeVersionDir(app, versoin string) (string, error)

GetHomeVersionDir returns home's versions dir for a certain app version

func GetHomeVersionsDir

func GetHomeVersionsDir(app string) (string, error)

GetHomeVersionsDir returns home's versions dir for app

func IsActiveVersion

func IsActiveVersion(app, version string) (bool, error)

IsActiveVersion returns bool if version is active

func IsInstalledVersion

func IsInstalledVersion(app, version string) (bool, string, error)

IsInstalledVersion returns true (first result) if version is installed

func IsSuitableAsset

func IsSuitableAsset(assetName, arch, os string) bool

IsSuitableAsset returns true if asset is suitable for download for current system

func PrepareHomeDir

func PrepareHomeDir(app string) error

PrepareHomeDir prepares home dir

func Unzip

func Unzip(src string, dest string) ([]string, error)

Unzip will decompress a zip archive, moving all files and folders within the zip file (parameter 1) to an output directory (parameter 2).

Types

type InstalledVersion

type InstalledVersion struct {
	Version string
	Date    time.Time
	Active  bool
}

InstalledVersion describes installed version

func ListInstalledVersions

func ListInstalledVersions(app string) ([]InstalledVersion, error)

ListInstalledVersions returns a slice of installed versions

Jump to

Keyboard shortcuts

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