hashitools

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2015 License: MPL-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GoInstaller

type GoInstaller struct {
	// Name is the name of the project to install
	Name string

	// Dir is the directory where projects will be installed. They will
	// be installed to a sub-directory of the project name. Example:
	// if Dir is "/foo", then the Packer binary would be installed to
	// "/foo/packer/packer"
	Dir string

	// Ui is the Otto UI for asking the user for input and outputting
	// the status of installation.
	Ui ui.Ui
}

GoInstaller is an Installer that knows how to install Go projects.

func (*GoInstaller) Install

func (i *GoInstaller) Install(vsn *version.Version) error

func (*GoInstaller) InstallAsk

func (i *GoInstaller) InstallAsk(installed, required, latest *version.Version) (bool, error)

func (*GoInstaller) Path

func (i *GoInstaller) Path() string

type Installer

type Installer interface {
	// InstallAsk should ask the user if they'd like to install the
	// project. This is only called if installation is actually required.
	InstallAsk(installed, required, latest *version.Version) (bool, error)

	// Install should install the specified version.
	Install(*version.Version) error

	// Path is the path to the installed main binary of this project,
	// or "" if it doesn't seem installed.
	Path() string
}

Installer is the interface that knows how to install things.

This is an interface to support different installation methods between our different projects.

type Project

type Project struct {
	// Name is the name of the project, all lowercase
	Name string

	// Installer is the installer for this project
	Installer Installer

	// MinVersion is the minimum version of this project that Otto
	// can use to function. This will be used with `InstallIfNeeded`
	// to prompt the user to install.
	MinVersion *version.Version
}

Project represents a HashiCorp Go project and provides various operations around that.

func (*Project) InstallIfNeeded

func (p *Project) InstallIfNeeded() error

InstallIfNeeded will check if installation of this project is required and will invoke the installer if needed.

func (*Project) LatestVersion

func (p *Project) LatestVersion() (*version.Version, error)

Latest version returns the latest version of this project.

func (*Project) Path

func (p *Project) Path() string

Path returns the path to this project. This will check if the project binary is pre-installed in our installation directory and use that path. Otherwise, it will return the raw project name.

func (*Project) Version

func (p *Project) Version() (*version.Version, error)

Version reads the version of this project.

type VagrantInstaller

type VagrantInstaller struct {
	// Ui is the Otto UI for asking the user for input and outputting
	// the status of installation.
	Ui ui.Ui
}

VagrantInstaller is an Installer that knows how to install Vagrant, which uses its own system installer.

func (*VagrantInstaller) Install

func (i *VagrantInstaller) Install(vsn *version.Version) error

func (*VagrantInstaller) InstallAsk

func (i *VagrantInstaller) InstallAsk(installed, required, latest *version.Version) (bool, error)

func (*VagrantInstaller) Path

func (i *VagrantInstaller) Path() string

Jump to

Keyboard shortcuts

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