Documentation ¶
Index ¶
- type AddDependencyFromTemplateOpts
- type Config
- func (c *Config) AddChecksums(dependencies []string, systems []SystemInfo) error
- func (c *Config) AddDependencyFromTemplate(ctx context.Context, templateName string, opts *AddDependencyFromTemplateOpts) error
- func (c *Config) BinName(depName string, system SystemInfo) (string, error)
- func (c *Config) BuildDependency(depName string, info SystemInfo) (*Dependency, error)
- func (c *Config) ClearCache() error
- func (c *Config) CopyTemplateFromSource(ctx context.Context, src, srcTemplate, destName string) error
- func (c *Config) DefaultSystems() []SystemInfo
- func (c *Config) DependencySystems(depName string) ([]SystemInfo, error)
- func (c *Config) DownloadDependency(name string, sysInfo SystemInfo, opts *ConfigDownloadDependencyOpts) (_ string, errOut error)
- func (c *Config) ExtractDependency(dependencyName string, sysInfo SystemInfo, opts *ConfigExtractDependencyOpts) (_ string, errOut error)
- func (c *Config) InstallDependency(dependencyName string, sysInfo SystemInfo, opts *ConfigInstallDependencyOpts) (_ string, errOut error)
- func (c *Config) ListTemplates(ctx context.Context, templateSource string) ([]string, error)
- func (c *Config) MissingDependencyVars(depName string) ([]string, error)
- func (c *Config) PruneChecksums() error
- func (c *Config) SetDependencyVars(depName string, vars map[string]string) error
- func (c *Config) SetTemplateVars(tmplName string, vars map[string]string) error
- func (c *Config) UnsetDependencyVars(depName string, vars []string) error
- func (c *Config) UnsetTemplateVars(tmplName string, vars []string) error
- func (c *Config) Validate(dependencies []string, systems []SystemInfo) (errOut error)
- type ConfigAddChecksumsOptions
- type ConfigDownloadDependencyOpts
- type ConfigExtractDependencyOpts
- type ConfigFile
- type ConfigInstallDependencyOpts
- type ConfigValidateOptions
- type Dependency
- type DependencyOverride
- type OverrideMatcher
- type SystemInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddDependencyFromTemplateOpts ¶ added in v3.1.0
type AddDependencyFromTemplateOpts struct { TemplateSource string DependencyName string Vars map[string]string }
AddDependencyFromTemplateOpts options for AddDependencyFromTemplate
type Config ¶
type Config struct { Cache string `json:"cache,omitempty" yaml:"cache,omitempty"` TrustCache bool `json:"trust_cache,omitempty" yaml:"trust_cache,omitempty"` InstallDir string `json:"install_dir,omitempty" yaml:"install_dir,omitempty"` Systems []SystemInfo `json:"systems,omitempty" yaml:"systems,omitempty"` Dependencies map[string]*Dependency `json:"dependencies,omitempty" yaml:",omitempty"` Templates map[string]*Dependency `json:"templates,omitempty" yaml:",omitempty"` TemplateSources map[string]string `json:"template_sources,omitempty" yaml:"template_sources,omitempty"` URLChecksums map[string]string `json:"url_checksums,omitempty" yaml:"url_checksums,omitempty"` }
Config is our main config
func ConfigFromURL ¶ added in v3.10.0
ConfigFromURL loads a config from a URL
func (*Config) AddChecksums ¶
func (c *Config) AddChecksums(dependencies []string, systems []SystemInfo) error
AddChecksums downloads, calculates checksums and adds them to the config's URLChecksums. AddChecksums skips urls that already exist in URLChecksums.
func (*Config) AddDependencyFromTemplate ¶ added in v3.1.0
func (c *Config) AddDependencyFromTemplate(ctx context.Context, templateName string, opts *AddDependencyFromTemplateOpts) error
AddDependencyFromTemplate adds a dependency to the config
func (*Config) BinName ¶
func (c *Config) BinName(depName string, system SystemInfo) (string, error)
BinName returns the bin name for a downloader on a given system
func (*Config) BuildDependency ¶ added in v3.1.1
func (c *Config) BuildDependency(depName string, info SystemInfo) (*Dependency, error)
BuildDependency returns a dependency with templates and overrides applied and variables interpolated for the given system.
func (*Config) ClearCache ¶ added in v3.16.0
func (*Config) CopyTemplateFromSource ¶ added in v3.3.0
func (c *Config) CopyTemplateFromSource(ctx context.Context, src, srcTemplate, destName string) error
CopyTemplateFromSource copies a template from source
func (*Config) DefaultSystems ¶ added in v3.1.1
func (c *Config) DefaultSystems() []SystemInfo
DefaultSystems returns c.Systems if it isn't empty. Otherwise returns the runtime system.
func (*Config) DependencySystems ¶ added in v3.3.0
func (c *Config) DependencySystems(depName string) ([]SystemInfo, error)
DependencySystems returns the supported systems of either the config or the dependency if one is not empty if both are not empty, it returns the intersection of the lists
func (*Config) DownloadDependency ¶
func (c *Config) DownloadDependency( name string, sysInfo SystemInfo, opts *ConfigDownloadDependencyOpts, ) (_ string, errOut error)
DownloadDependency downloads a dependency
func (*Config) ExtractDependency ¶
func (c *Config) ExtractDependency(dependencyName string, sysInfo SystemInfo, opts *ConfigExtractDependencyOpts) (_ string, errOut error)
ExtractDependency downloads and extracts a dependency
func (*Config) InstallDependency ¶
func (c *Config) InstallDependency(dependencyName string, sysInfo SystemInfo, opts *ConfigInstallDependencyOpts) (_ string, errOut error)
InstallDependency downloads, extracts and installs a dependency
func (*Config) ListTemplates ¶ added in v3.1.0
ListTemplates lists templates available in this config or one of its template sources.
func (*Config) MissingDependencyVars ¶ added in v3.1.0
MissingDependencyVars returns a list of vars that are required but undefined
func (*Config) PruneChecksums ¶ added in v3.8.0
PruneChecksums removes checksums for dependencies that are not used by any configured system.
func (*Config) SetDependencyVars ¶ added in v3.4.0
SetDependencyVars sets the value of a dependency's var. Adds or Updates the var.
func (*Config) SetTemplateVars ¶ added in v3.4.0
SetTemplateVars sets the value of a template's var. Adds or Updates the var.
func (*Config) UnsetDependencyVars ¶ added in v3.4.0
UnsetDependencyVars removes a dependency var. Noop if the var doesn't exist.
func (*Config) UnsetTemplateVars ¶ added in v3.4.0
UnsetTemplateVars removes a template var. Noop if the var doesn't exist.
type ConfigAddChecksumsOptions ¶
type ConfigAddChecksumsOptions struct { // Only add checksums for these dependencies. When Dependencies is empty, AddChecksums adds checksums for all // configured dependencies. Dependencies []string // Only add checksums for these system targets. When Systems is empty, AddChecksums adds checksums for all known // builds configured for each dependency. Systems []SystemInfo }
ConfigAddChecksumsOptions was never used but included by mistake. It will be removed in a future release.
type ConfigDownloadDependencyOpts ¶
ConfigDownloadDependencyOpts options for Config.DownloadDependency
type ConfigExtractDependencyOpts ¶
type ConfigExtractDependencyOpts struct { TargetDirectory string Force bool AllowMissingChecksum bool }
ConfigExtractDependencyOpts options for Config.ExtractDependency
type ConfigFile ¶ added in v3.1.0
ConfigFile is a file containing config
func LoadConfigFile ¶ added in v3.1.0
LoadConfigFile loads a config file
func (*ConfigFile) Write ¶ added in v3.1.0
func (c *ConfigFile) Write(outputJSON bool) error
Write writes a file to disk
type ConfigInstallDependencyOpts ¶
type ConfigInstallDependencyOpts struct { // TargetPath is the path where the executable should end up TargetPath string // Force - install even if it already exists Force bool // AllowMissingChecksum - whether to allow missing checksum AllowMissingChecksum bool }
ConfigInstallDependencyOpts provides options for Config.InstallDependency
type ConfigValidateOptions ¶
type ConfigValidateOptions struct { // Only validates these dependencies. When Dependencies is empty, Validate validates all configured dependencies. Dependencies []string // Only validates system targets. When Systems is empty, AddChecksums validates all known builds configured for each // dependency. Systems []SystemInfo }
ConfigValidateOptions was never used but included by mistake. It will be removed in a future release.
type Dependency ¶
type Dependency struct { Homepage *string `json:"homepage,omitempty" yaml:",omitempty"` Description *string `json:"description,omitempty" yaml:",omitempty"` Template *string `json:"template,omitempty" yaml:",omitempty"` URL *string `json:"url,omitempty" yaml:",omitempty"` 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"` Vars map[string]string `json:"vars,omitempty" yaml:",omitempty"` RequiredVars []string `json:"required_vars,omitempty" yaml:"required_vars,omitempty"` Overrides []DependencyOverride `json:"overrides,omitempty" yaml:",omitempty"` Substitutions map[string]map[string]string `json:"substitutions,omitempty" yaml:",omitempty"` Systems []SystemInfo `json:"systems,omitempty" yaml:"systems,omitempty"` }
Dependency is something to download, extract and install
type DependencyOverride ¶
type DependencyOverride struct { OverrideMatcher OverrideMatcher `json:"matcher" yaml:"matcher,omitempty"` Dependency Dependency `json:"dependency" yaml:",omitempty"` }
DependencyOverride overrides a dependency's configuration
type OverrideMatcher ¶
OverrideMatcher contains a list or oses and arches to match an override. If either os or arch is empty, all oses and arches match.
type SystemInfo ¶
SystemInfo contains os and architecture for a target system
func (SystemInfo) MarshalText ¶
func (s SystemInfo) MarshalText() (text []byte, err error)
MarshalText implements encoding.TextMarshaler
func (*SystemInfo) String ¶
func (s *SystemInfo) String() string
func (*SystemInfo) UnmarshalText ¶
func (s *SystemInfo) UnmarshalText(text []byte) error
UnmarshalText implements encoding.TextUnmarshaler