otto

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: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestApp

func TestApp(t *testing.T, tuple app.Tuple, c *CoreConfig) *app.Mock

TestApp adds a mock app with the given tuple to the core config.

func TestInfra

func TestInfra(t *testing.T, n string, c *CoreConfig) *infrastructure.Mock

TestInfra adds a mock infrastructure with the given name to the core config and returns it.

Types

type Core

type Core struct {
	// contains filtered or unexported fields
}

Core is the main struct to use to interact with Otto as a library.

func NewCore

func NewCore(c *CoreConfig) (*Core, error)

NewCore creates a new core.

Once this function is called, this CoreConfig should not be used again or modified, since the Core may use parts of it without deep copying.

func (*Core) Build

func (c *Core) Build() error

Build builds the deployable artifact for the currently compiled Appfile.

func (*Core) Compile

func (c *Core) Compile() error

Compile takes the Appfile and compiles all the resulting data.

func (*Core) Deploy

func (c *Core) Deploy(action string, args []string) error

Deploy deploys the application.

Deploy supports subactions, which can be specified with action and args. Action can be "" to get the default deploy behavior.

func (*Core) Dev

func (c *Core) Dev() error

Dev starts a dev environment for the current application. For destroying and other tasks against the dev environment, use the generic `Execute` method.

func (*Core) Execute

func (c *Core) Execute(opts *ExecuteOpts) error

Execute executes the given task for this Appfile.

func (*Core) Infra

func (c *Core) Infra(action string, args []string) error

Infra manages the infrastructure for this Appfile.

Infra supports subactions, which can be specified with action and args. Infra recognizes two special actions: "" (blank string) and "destroy". The former expects to create or update the complete infrastructure, and the latter will destroy the infrastructure.

func (*Core) Status

func (c *Core) Status() error

Status outputs to the UI the status of all the stages of this application.

type CoreConfig

type CoreConfig struct {
	// DataDir is the directory where local data will be stored that
	// is global to all Otto processes.
	//
	// LocalDir is the directory where data local to this single Appfile
	// will be stored. This isn't necessarilly cleared for compilation.
	//
	// CompiledDir is the directory where compiled data will be written.
	// Each compilation will clear this directory.
	DataDir    string
	LocalDir   string
	CompileDir string

	// Appfile is the appfile that this core will be using for configuration.
	// This must be a compiled Appfile.
	Appfile *appfile.Compiled

	// Directory is the directory where data is stored about this Appfile.
	Directory directory.Backend

	// Apps is the map of available app implementations.
	Apps map[app.Tuple]app.Factory

	// Infrastructures is the map of available infrastructures. The
	// value is a factory that can create the infrastructure impl.
	Infrastructures map[string]infrastructure.Factory

	// Foundations is the map of available foundations. The
	// value is a factory that can create the impl.
	Foundations map[foundation.Tuple]foundation.Factory

	// Ui is the Ui that will be used to communicate with the user.
	Ui ui.Ui
}

CoreConfig is configuration for creating a new core with NewCore.

func TestCoreConfig

func TestCoreConfig(t *testing.T) *CoreConfig

TestCoreConfig returns a CoreConfig that can be used for testing.

type Error

type Error interface {
	OriginalError() error
	Code() string
}

Error is the interface implemented by many errors within Otto. You can use it to check what the type of an error is via the list of error codes below.

type ExecuteOpts

type ExecuteOpts struct {
	// Task is the task to execute
	Task ExecuteTask

	// Action is a sub-action that a task can take. For example:
	// infrastructures accept "destroy", development environments
	// accept "reload", etc.
	Action string

	// Args are additional arguments to the task
	Args []string
}

ExecuteOpts are the options used for executing generic tasks on the Otto environment.

type ExecuteTask

type ExecuteTask uint

ExecuteTask is an enum of available tasks to execute.

const (
	ExecuteTaskInvalid ExecuteTask = 0
	ExecuteTaskDev
)

func (ExecuteTask) String

func (i ExecuteTask) String() string

Jump to

Keyboard shortcuts

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