Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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) Deploy ¶
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 ¶
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 ¶
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.
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 ¶
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