bindown

package module
v2.1.2 Latest Latest
Warning

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

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

README

bindown

bindown is a command-line utility to download, verify and install binary files. It is intended to be used in development and ci environments where it is important to guarantee the same version of the same binary is downloaded every time.

Usage

 Usage: bindown <command>

Flags:
  --help                            Show context-sensitive help.
  --configfile="buildtools.json"    file with tool definitions
  --cellar-dir=STRING               directory where downloads will be cached

Commands:
  version

  download <target-file>
    download a bin

  config format
    formats the config file

  config update-checksums <target-file>
    name of the binary to update

  config validate <bin>
    validate that downloads work

Run "bindown <command> --help" for more information on a command.

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 LoadConfigFile

func LoadConfigFile(configFile string) (*Config, error)

LoadConfigFile returns a Config from the path to a config file

func (*Config) Downloader

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

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

type Downloader

type Downloader struct {
	OS          string `json:"os"`
	Arch        string `json:"arch"`
	URL         string `json:"url"`
	Checksum    string `json:"checksum,omitempty"`
	ArchivePath string `json:"archive_path,omitempty"`
	Link        bool   `json:"link,omitempty"`
	BinName     string `json:"bin,omitempty"`

	// Deprecated: use ArchivePath
	MoveFrom string `json:"move-from,omitempty"`

	// Deprecated: use ArchivePath and Link
	LinkSource string `json:"symlink,omitempty"`
}

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

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
}

InstallOpts options for Install

type UpdateChecksumOpts

type UpdateChecksumOpts 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
}

UpdateChecksumOpts options for UpdateChecksum

Directories

Path Synopsis
cmd
bindown command

Jump to

Keyboard shortcuts

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