Documentation ¶
Index ¶
- type Config
- func (c *Config) AddDownloaderChecksums(downloaderName, cellarDir string) error
- func (c *Config) Downloader(binary, os, arch string) *Downloader
- func (c *Config) DownloaderExtractDir(downloader *Downloader, binName, cellarDir string) (string, error)
- func (c *Config) Validate(downloaderName string, cellarDir string) error
- type ConfigFile
- type Downloader
- type InstallOpts
- type UpdateChecksumOpts
- type ValidateOpts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Downloaders map[string][]*Downloader `json:"downloaders,omitempty" yaml:"downloaders"` URLChecksums map[string]string `json:"url_checksums,omitempty" yaml:"url_checksums,omitempty"` }
Config is downloaders configuration
func (*Config) AddDownloaderChecksums ¶ added in v2.7.1
AddDownloaderChecksums adds checksums to c.URLChecksums
func (*Config) Downloader ¶
func (c *Config) Downloader(binary, os, arch string) *Downloader
Downloader returns a Downloader for the given binary, os and arch.
func (*Config) DownloaderExtractDir ¶ added in v2.8.0
func (c *Config) DownloaderExtractDir(downloader *Downloader, binName, cellarDir string) (string, error)
DownloaderExtractDir returns the directory where a downloader's archive will be extracted
type ConfigFile ¶ added in v2.2.0
type ConfigFile struct { Config // contains filtered or unexported fields }
ConfigFile represents a config file
func LoadConfigFile ¶
func LoadConfigFile(file string) (*ConfigFile, error)
LoadConfigFile loads a config file
func (*ConfigFile) Write ¶ added in v2.2.0
func (c *ConfigFile) Write() error
type Downloader ¶
type Downloader struct { OS string `json:"os"` Arch string `json:"arch"` URL string `json:"url"` ArchivePath string `json:"archive_path,omitempty" yaml:"archive_path,omitempty"` BinName string `json:"bin,omitempty" yaml:"bin,omitempty"` Link bool `json:"link,omitempty" yaml:",omitempty"` Checksum string `json:"checksum,omitempty" yaml:",omitempty"` Vars map[string]string `json:"vars,omitempty" yaml:"vars,omitempty"` // contains filtered or unexported fields }
Downloader downloads a binary
func (*Downloader) Install ¶
func (d *Downloader) Install(opts InstallOpts) error
Install downloads and installs a bin
func (*Downloader) UpdateChecksum ¶
func (d *Downloader) UpdateChecksum(opts UpdateChecksumOpts) error
UpdateChecksum updates the checksum based on a fresh download
func (*Downloader) Validate ¶ added in v2.1.1
func (d *Downloader) Validate(opts ValidateOpts) error
Validate installs the downloader to a temporary directory and returns an error if it was unsuccessful. If cellarDir is "", it will use a temp directory
type InstallOpts ¶
type InstallOpts struct { // DownloaderName is the downloader's key from the config file DownloaderName string // CellarDir is the directory where downloads and extractions will be placed. Default is a <TargetDir>/.bindown CellarDir string // TargetDir is the directory where the executable should end up TargetDir string // Force - whether to force the install even if it already exists Force bool // Map of known checksums to validate against URLChecksums map[string]string }
InstallOpts options for Install
type UpdateChecksumOpts ¶
type UpdateChecksumOpts struct { // CellarDir is the directory where downloads and extractions will be placed. Default is a temp directory. CellarDir string URLChecksums map[string]string }
UpdateChecksumOpts options for UpdateChecksum
type ValidateOpts ¶ added in v2.4.3
type ValidateOpts struct { // DownloaderName is the downloader's key from the config file DownloaderName string // CellarDir is the directory where downloads and extractions will be placed. Default is a temp directory. CellarDir string }
ValidateOpts is options for Validate