Documentation
¶
Index ¶
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func MustAsset(name string) []byte
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type GoInstaller
- type Installer
- type Project
- type VagrantInstaller
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/
foo.txt
img/
a.png
b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
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) 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 ¶
InstallIfNeeded will check if installation of this project is required and will invoke the installer if needed.
func (*Project) LatestVersion ¶
Latest version returns the latest 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) InstallAsk ¶
func (i *VagrantInstaller) InstallAsk(installed, required, latest *version.Version) (bool, error)
func (*VagrantInstaller) Path ¶
func (i *VagrantInstaller) Path() string