download

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Conda      string = "conda"
	CondaForge string = "conda-forge"
	Coursier   string = "coursier"
	Unarchiver string = "unarchiver"
	Executable string = "executable"
	Dpkg       string = "dpkg"
	Rpm        string = "rpm"
)
View Source
const (
	SDKListFileName string = "sdk_list.json"
)

Variables

This section is empty.

Functions

func CheckSumForVersionFile

func CheckSumForVersionFile(sdkName, newSha256 string) (ok bool, fPath string)

Download version list file.

func FilterVersionItem

func FilterVersionItem(item Item) (ok bool)

func GetSDKSortedRows

func GetSDKSortedRows(ss SDKList) (rows []table.Row)

func GetVersionFilePath added in v0.6.4

func GetVersionFilePath(sdkName string) (fPath string)

func GetVersionList

func GetVersionList(sdkName, newSha256 string) (filteredVersions map[string]Item)

func GetVersionsSortedRows

func GetVersionsSortedRows(filteredVersions map[string]Item) (rows []table.Row)

func SortVersionAscend

func SortVersionAscend(versions []table.Row)

func SortVersions

func SortVersions(versions []table.Row)

SortVersions sorts a slice of version strings in descending order.

Types

type AdditionalEnv

type AdditionalEnv struct {
	Name    string
	Value   []DirPath // <symbolLinkPath>/<filepath.Join(Value)>
	Version string    // major>8 or major<=8(for JDK)
}

type AdditionalEnvList

type AdditionalEnvList []AdditionalEnv

type BinaryRename

type BinaryRename struct {
	NameFlag string `toml:"name_flag"`
	RenameTo string `toml:"rename_to"`
}

type DirItems

type DirItems struct {
	Windows []DirPath `toml:"windows"` // <symbolLinkPath>/<filepath.Join(List)>, ...
	Linux   []DirPath `toml:"linux"`
	MacOS   []DirPath `toml:"darwin"`
}

type DirPath

type DirPath []string

type Downloader

type Downloader struct {
	Fetcher     *request.Fetcher
	SDKName     string
	VersionName string
	Version     Item
}

func NewDownloader

func NewDownloader() (d *Downloader)

func (*Downloader) Download

func (d *Downloader) Download(OriginSDKName, versionName string, version Item, force ...bool) (fPath string)

type FileItems

type FileItems struct {
	Windows []string `toml:"windows"`
	Linux   []string `toml:"linux"`
	MacOS   []string `toml:"darwin"`
}

type InstallerConfig

type InstallerConfig struct {
	FlagFiles       *FileItems        `toml:"flag_files"`
	FlagDirExcepted bool              `toml:"flag_dir_excepted"`
	BinaryDirs      *DirItems         `toml:"binary_dirs"`
	BinaryRename    *BinaryRename     `toml:"binary_rename"`
	AdditionalEnvs  AdditionalEnvList `toml:"additional_envs"`
}

Installation configs

func GetSDKInstallationConfig

func GetSDKInstallationConfig(sdkName, newSha256 string) (ic InstallerConfig)

SDK installation config file.

type Item

type Item struct {
	Url       string `json:"url"`       // download url
	Arch      string `json:"arch"`      // amd64 | arm64
	Os        string `json:"os"`        // linux | darwin | windows
	Sum       string `json:"sum"`       // Checksum
	SumType   string `json:"sum_type"`  // sha1 | sha256 | sha512 | md5
	Size      int64  `json:"size"`      // Size in bytes
	Installer string `json:"installer"` // conda | conda-forge | coursier | unarchiver | executable | dpkg | rpm
	LTS       string `json:"lts"`       // Long Term Support
	Extra     string `json:"extra"`     // Extra Info
}

func GetLatestVersionBySDKName

func GetLatestVersionBySDKName(sdkName string) (vName string, vItem Item)

type SDK

type SDK struct {
	Sha256            string `json:"sha256"`
	HomePage          string `json:"homepage"`
	InstallConfSha256 string `json:"install_conf_sha256"`
}

Download SDK List file.

type SDKList

type SDKList map[string]SDK

func GetSDKList

func GetSDKList() (ss SDKList)

type SDKVersion

type SDKVersion []Item

type Version

type Version struct {
	Major int
	Minor int
	Patch int
	Build int
	Beta  int
	RC    int
}

Version represents a version number.

func ParseVersion

func ParseVersion(version string) (v Version, err error)

ParseVersion parses a version string into a Version struct.

type VersionList

type VersionList map[string]SDKVersion

Jump to

Keyboard shortcuts

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