compile

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func App

func App(opts *AppOptions) (*app.CompileResult, error)

App is an opinionated compilation function to help implement app.App.Compile.

AppOptions may be modified by this function during this call.

func Foundation

func Foundation(opts *FoundationOptions) (*foundation.CompileResult, error)

Foundation is an opinionated compilation function to help implement foundation.Foundation.Compile.

FoundationOptions may be modified by this function during this call.

Types

type AppOptions

type AppOptions struct {
	// Ctx is the app context of this compilation.
	Ctx *app.Context

	// FoundationConfig is the configuration for the foundation that
	// will be returned as the compilation result.
	FoundationConfig foundation.Config

	// Bindata is the data that is used for templating. This must be set.
	// Template data should also be set on this. This will be modified with
	// default template data if those keys are not set.
	Bindata *bindata.Data

	// Customizations is a list of helpers to process customizations
	// in the Appfile. See the Customization docs for more information.
	Customizations []*Customization

	// Callbacks are called just prior to compilation completing.
	Callbacks []CompileCallback
}

AppOptions are the options for compiling an application.

These options may be modified during customization processing, and in fact that is an intended use case and common pattern. To do this, use the AppCustomizationFunc method. See some of the builtin types for examples.

type CompileCallback

type CompileCallback func() error

CompileCallback is a callback that can be registered to be run after compilation. To access any data within this callback, it should be created as a closure around the AppOptions.

type Customization

type Customization struct {
	// Type is the type of the customization, such as "dev"
	Type string

	// Schema is the schema for the data. This will be automatically
	// validated with the data from the configuration.
	Schema map[string]*schema.FieldSchema

	// Callback is called to process this customization.
	Callback CustomizationFunc
}

Customization defines how customizations are handled during compilation and are used for both App and Infra compilations.

Customizations are the "customization" stanzas within the Appfile.

Customizations are processed by querying the type given and then calling the Callback. The CustomizationResult that is returned will modify the behavior of the compilation process.

type CustomizationFunc

type CustomizationFunc func(*schema.FieldData) error

CustomizationFunc is the callback called for customizations.

type FoundationOptions

type FoundationOptions struct {
	// Ctx is the foundation context of this compilation.
	Ctx *foundation.Context

	// Bindata is the data that is used for templating. This must be set.
	// Template data should also be set on this. This will be modified with
	// default template data if those keys are not set.
	Bindata *bindata.Data

	// Customizations is a list of helpers to process customizations
	// in the Appfile. See the Customization docs for more information.
	Customizations []*Customization

	// Callbacks are called just prior to compilation completing.
	Callbacks []CompileCallback
}

FoundationOptions are the options for compiling a foundation.

These options may be modified during customization processing, and in fact that is an intended use case and common pattern. To do this, use the FoundationCustomizationFunc method. See some of the builtin types for examples.

Jump to

Keyboard shortcuts

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