vagrant

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2015 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(ctx *app.Context, opts *BuildOptions) error

Build can be used to use Vagrant to build something. This will handle starting Vagrant, running the script, collecting files into a list, and destroying the Vagrant environment.

func Dev

func Dev(opts *DevOptions) *router.Router

Dev can be used as an implementation of app.App.Dev to automatically handle creating a development environment and forwarding commands down to Vagrant.

func DevDep

func DevDep(dst *app.Context, src *app.Context, opts *DevDepOptions) (*app.DevDep, error)

DevDep builds a dev dependency using Vagrant.

This function uses Build to build the dev dependency. Please see the documentation of that function for more details on how that works.

This function implements app.App.DevDep.

func Project

func Project(ctx *context.Shared) *hashitools.Project

Project returns the hashitools Project for this.

Types

type BuildOptions

type BuildOptions struct {
	// Dir is the directory where Vagrant will be executed for the
	// build. This should be the directory with the Vagrantfile, usually.
	Dir string

	// Script is the script to execute within the VM. This script must
	// not ask for input.
	Script string
}

type DevDepOptions

type DevDepOptions struct {
	// Dir is the directory where Vagrant will be executed.
	Dir string

	// Script is the script to run to build the dev dependency.
	Script string

	// Files are the resulting files relative to the cache directory
	// that are part of the dep. If these don't exist, an error will be
	// generated.
	Files []string
}

type DevOptions

type DevOptions struct {
	// Dir is the path to the directory with the Vagrantfile. This
	// will default to `#{ctx.Dir}/dev` if empty.
	Dir string

	// DataDir is the path to the directory where Vagrant should store its data.
	// Defaults to `#{ctx.LocalDir/vagrant}` if empty.
	DataDir string

	// Instructions are help text that is shown after creating the
	// development environment.
	Instructions string
}

DevOptions is the configuration struct used for Dev.

type SSHCache

type SSHCache struct {
	// Path is the path to where the SSH cache file should go
	Path string

	// Vagrant is the Vagrant instance we'll use to execute Vagrant commands.
	Vagrant *Vagrant
}

SSHCache is a helper to cache the SSH connection info from Vagrant and use that for executing to avoid the overhead of loading Vagrant.

func (*SSHCache) Cache

func (c *SSHCache) Cache() error

Cache will execute "ssh-config" and cache the SSH info.

func (*SSHCache) Delete

func (c *SSHCache) Delete() error

Delete clears the cache.

func (*SSHCache) Exec

func (c *SSHCache) Exec(cacheOkay bool) error

Exec executes SSH and opens a console.

This will use the cached SSH info if it exists, or will otherwise drop into `vagrant ssh`. If cacheOkay is false, then it'll always go straight to `vagrant ssh`.

type Vagrant

type Vagrant struct {
	// Dir is the working directory where all Vagrant commands will
	// be executed from.
	Dir string

	// DataDir is the directory where Vagrant commands should store data.
	DataDir string

	// Ui, if given, will be used to stream output from the Vagrant
	// commands. If this is nil, then the output will be logged but
	// won't be visible to the user.
	Ui ui.Ui
}

Vagrant wraps `vagrant` execution into an easy-to-use API.

func (*Vagrant) Execute

func (v *Vagrant) Execute(command ...string) error

Execute executes a raw Vagrant command.

Jump to

Keyboard shortcuts

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