config

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

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"`
}

Config is downloaders configuration

func LoadConfig

func LoadConfig(config io.Reader) (*Config, error)

LoadConfig returns a Config from a config reader

func (*Config) Downloader

func (c *Config) Downloader(binary, opSys, arch string) Downloader

Downloader returns a Downloader for the given binary, os and arch.

func (*Config) UnmarshalJSON

func (c *Config) UnmarshalJSON(p []byte) error

UnmarshalJSON implements json.Unmarshaler

func (*Config) UpdateChecksums

func (c *Config) UpdateChecksums(binary, cellarDir string) error

UpdateChecksums updates the checksums for binary's downloaders

func (*Config) Validate

func (c *Config) Validate(binary, cellarDir string) error

Validate runs validate on all Downloaders for the given binary. error may be a multierr. Individual errors can be retrieved with multierr.Errors(err)

type Downloader

type Downloader interface {
	ErrString(binary string) string
	MatchesOS(opSys string) bool
	MatchesArch(arch string) bool
	HasChecksum(checksum string) bool
	UpdateChecksum(cellarDir string) error
	Install(downloaderName, cellarDir, targetDir string, force bool) error
	Validate(cellarDir string) error
}

Downloader interface for *bindown.Downloader

type File

type File struct {
	*Config
	// contains filtered or unexported fields
}

File represents a config file

func NewConfigFile

func NewConfigFile(filename string) (*File, error)

NewConfigFile creates a *File for the file at filename

func (*File) WriteFile

func (c *File) WriteFile() error

WriteFile writes config back to the file

Directories

Path Synopsis
internal
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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