compile

package
Version: v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2016 License: MPL-2.0 Imports: 15 Imported by: 132

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Data = bindata.Data{
	Asset:    Asset,
	AssetDir: AssetDir,
}

Data is the compiled bindata for this package. This isn't a pointer to force a copy so that Context data is never shared.

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 AppTest added in v0.2.0

func AppTest(on bool)

AppTest enables/disables test mode for the compilation package. When test mode is enabled, the test steps can be used to make assertions about the compilation process.

Always be sure to defer and disable this.

This should not be used outside of tests. Within tests, this cannot be parallelized since it uses global state.

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

	// Result is the base CompileResult that will be used to return the result.
	// You can set this if you want to override some settings.
	Result *app.CompileResult

	// 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

	// ScriptPacks are a list of ScriptPacks that this app wants available
	// to it. Each of these scriptpacks and all of the dependencies will be
	// expanded into the compiled directory and the paths to them will be
	// available in the Bindata context.
	//
	// The uploaded ScriptPacks are tar.gzipped.
	ScriptPacks []*scriptpack.ScriptPack

	// Customization is used to configure the customizations for this
	// application. See the Customization type docs for more info.
	Customization *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 AppTestStepContext added in v0.2.0

type AppTestStepContext struct {
	Key   string
	Value interface{}
}

AppTestStepContext is an otto.TestStep that tests the value of something in the template context.

func (*AppTestStepContext) Run added in v0.2.0

func (s *AppTestStepContext) Run(c *otto.Core) error

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 {
	// Schema is the actual schema of the customization configuration. This
	// will be type validated automatically.
	Schema map[string]*schema.FieldSchema

	// Callback is the callback that is called to process this customization.
	// This is guaranteed to be called even if there is no customization set
	// to allow you to setup defaults.
	Callback CustomizationFunc
}

Customization is used to configure how customizations are processed.

func VagrantCustomizations added in v0.2.0

func VagrantCustomizations(opts *AppOptions) *Customization

VagrantCustomizations returns common Vagrant customizations that work with the default settings of the app compilation helper.

func (*Customization) Merge added in v0.2.0

func (c *Customization) Merge(other *Customization) *Customization

Merge will merge this customization with the other and return a new customization. The original customization is not modified.

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

	// Customization is used to configure the customizations for this
	// application. See the Customization type docs for more info.
	Customization *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