Documentation ¶
Index ¶
- Constants
- Variables
- func AddBuiltin(desc BuiltinDesc)
- func AddTask(task TaskDesc)
- func ApplyTheme(theme *Theme)
- func ApplyThemeByName(name string) error
- func CheckTaskArgs(m map[string]TaskDesc, t TaskDesc) error
- func CheckType(field reflect.StructField, value interface{}) bool
- func CopyValue(orig, dest reflect.Value)
- func EvaluateTaskArgs(args TaskArgs, typ reflect.Type, context *Context) (result interface{}, err error)
- func FieldIs(field reflect.StructField, quality string) bool
- func FindParent(parent, repository string) ([]string, error)
- func FindParents(repository string) ([]string, error)
- func FindTemplate(template, repository string) ([]string, error)
- func FindTemplates(repository string) ([]string, error)
- func FormatScriptError(err error) error
- func FormatTarget(name, doc string, depends []string, length int) string
- func GetQuality(field reflect.StructField, quality string) string
- func HasField(t reflect.Type, n string) bool
- func Info(text string, args ...interface{})
- func InfoBuiltin(builtin string) string
- func InfoBuiltins() string
- func InfoBuiltinsReference() string
- func InfoParents(repository string) string
- func InfoTask(task string) string
- func InfoTasks() string
- func InfoTasksReference() string
- func InfoTemplates(repository string) string
- func InfoThemes() string
- func InstallPlugin(plugin, repository string) error
- func IsExpression(s string) bool
- func IsValueOfType(value interface{}, typ reflect.Type) bool
- func LinkPath(name, repository string) string
- func ListenPort(port int) (net.Listener, error)
- func LoadBuiltins(vm *vm.Env)
- func Message(text string, args ...interface{})
- func ParseAttributes(colors []string) ([]color.Attribute, error)
- func ParseConfiguration(object util.Object, build *Build) error
- func ParseContext(object util.Object, build *Build) error
- func ParseDefault(object util.Object, build *Build) error
- func ParseDoc(object util.Object, build *Build) error
- func ParseEnvironment(object util.Object, build *Build) error
- func ParseExpose(object util.Object, build *Build) error
- func ParseExtends(object util.Object, build *Build) error
- func ParseFields(object util.Object, build *Build, repo string) error
- func ParseProperties(object util.Object, build *Build) error
- func ParseRepository(object util.Object, build *Build, repository string) error
- func ParseShell(object util.Object, build *Build) error
- func ParseSingleton(object util.Object, build *Build) error
- func ParseTargetDepends(object util.Object, target *Target) error
- func ParseTargetDoc(object util.Object, target *Target) error
- func ParseTargetSteps(object util.Object, target *Target) error
- func ParseTargetUnless(object util.Object, target *Target) error
- func ParseTargets(object util.Object, build *Build) error
- func ParseVersion(object util.Object, build *Build) error
- func PrintError(text string)
- func PrintOk()
- func PropertyToString(object interface{}, quotes bool) (string, error)
- func SetDirectories(build *Build, base string) error
- func TemplatePath(name, repository string) (string, error)
- func Title(text string)
- func Update(repository string) error
- func ValidateTaskArgs(args TaskArgs, typ reflect.Type) error
- type Build
- func (build *Build) CheckVersion(context *Context) error
- func (build *Build) EnsureSingle(context *Context) (net.Listener, error)
- func (build *Build) FormatTargets() string
- func (build *Build) GetDefault() []string
- func (build *Build) GetEnvironment() map[string]string
- func (build *Build) GetParentTarget(name string) (*Target, error)
- func (build *Build) GetParents() ([]*Build, error)
- func (build *Build) GetProperties() util.Object
- func (build *Build) GetScripts() []string
- func (build *Build) GetShell() ([]string, error)
- func (build *Build) GetTarget(name string) *Target
- func (build *Build) GetTargets() map[string]*Target
- func (build *Build) Info(context *Context) (string, error)
- func (build *Build) ParentPath(name string) (string, error)
- func (build *Build) Run(context *Context, targets []string) error
- func (build *Build) RunParentTarget(context *Context, name string) error
- func (build *Build) RunTarget(context *Context, name string) error
- func (build *Build) ScriptPath(name string) (string, error)
- func (build *Build) SetCommandLineProperties(props string) error
- func (build *Build) SetDir(dir string)
- func (build *Build) SetRoot(root *Build)
- func (build *Build) SubTree(margin string, next bool)
- func (build *Build) Tree()
- type BuiltinDesc
- type Colors
- type Context
- func (context *Context) Copy() *Context
- func (context *Context) DelProperty(name string) error
- func (context *Context) EvaluateEnvironment() ([]string, error)
- func (context *Context) EvaluateExpression(expression string) (interface{}, error)
- func (context *Context) EvaluateObject(object interface{}) (interface{}, error)
- func (context *Context) EvaluateString(text string) (string, error)
- func (context *Context) GetProperty(name string) (interface{}, error)
- func (context *Context) Init() error
- func (context *Context) InitProperties() error
- func (context *Context) InitScripts() error
- func (context *Context) Message(text string, args ...interface{})
- func (context *Context) SetProperty(name string, value interface{})
- type ScriptStep
- type Stack
- type Step
- type Steps
- type Target
- type TaskArgs
- type TaskDesc
- type TaskFunc
- type TaskStep
- type Theme
- type Version
Constants ¶
const ( // DefaultRepository is local repository root directory DefaultRepository = "~/.neon" // RegexpPlugin is regexp for a plugin name RegexpPlugin = `[\w-]+/[\w-]+` )
const ( // character that start expressions CharExpression = "=" // expression curly brace CurlyExpression = "{" // tag name NeonTag = "neon" // tag separator TagSeparator = "," // field might not be provided FieldOptional = "optional" // field is a file name that is expanded for user home FieldFile = "file" // field is an expression FieldExpression = "expression" // field should be rapped in a slice of its type FieldWrap = "wrap" // field is a list of steps FieldSteps = "steps" // field has a different name FieldName = "name" )
character for expressions
const (
// PluginSite is default site for plugins
PluginSite = "github.com"
)
Variables ¶
var Attributes = map[string]color.Attribute{ "Reset": color.Reset, "Bold": color.Bold, "Faint": color.Faint, "Italic": color.Italic, "Underline": color.Underline, "BlinkSlow": color.BlinkSlow, "BlinkRapid": color.BlinkRapid, "ReverseVideo": color.ReverseVideo, "Concealed": color.Concealed, "CrossedOut": color.CrossedOut, "FgBlack": color.FgBlack, "FgRed": color.FgRed, "FgGreen": color.FgGreen, "FgYellow": color.FgYellow, "FgBlue": color.FgBlue, "FgMagenta": color.FgMagenta, "FgCyan": color.FgCyan, "FgWhite": color.FgWhite, "FgHiBlack": color.FgHiBlack, "FgHiRed": color.FgHiRed, "FgHiGreen": color.FgHiGreen, "FgHiYellow": color.FgHiYellow, "FgHiBlue": color.FgHiBlue, "FgHiMagenta": color.FgHiMagenta, "FgHiCyan": color.FgHiCyan, "FgHiWhite": color.FgHiWhite, "BgBlack": color.BgBlack, "BgRed": color.BgRed, "BgGreen": color.BgGreen, "BgYellow": color.BgYellow, "BgBlue": color.BgBlue, "BgMagenta": color.BgMagenta, "BgCyan": color.BgCyan, "BgWhite": color.BgWhite, "BgHiBlack": color.BgHiBlack, "BgHiRed": color.BgHiRed, "BgHiGreen": color.BgHiGreen, "BgHiYellow": color.BgHiYellow, "BgHiBlue": color.BgHiBlue, "BgHiMagenta": color.BgHiMagenta, "BgHiCyan": color.BgHiCyan, "BgHiWhite": color.BgHiWhite, }
Attributes values by name
var BuiltinMap = make(map[string]BuiltinDesc)
BuiltinMap is a map of builtin descriptors by name
var Fields = []string{"doc", "default", "extends", "repository", "context", "singleton",
"shell", "properties", "configuration", "expose", "environment", "targets", "version"}
Fields is the list of possible root fields for a build file
var Grey = false
Grey is a flag that tells if we print on console without color
var NeonVersion = "UNKNOWN"
NeonVersion is passed while compiling
var RegexSuffixes = `SNAPSHOT|ALPHA|BETA|RC|snapshot|alpha|beta|rc`
RegexSuffixes is a regexp for version suffixes
var RegexpLinkName = regexp.MustCompile(`[^/]+/[^/]+/[^/]+.yml`)
RegexpLinkName is regexp for parent name
var RegexpParentName = regexp.MustCompile(`[^/]+/[^/]+/[^/]+.yml`)
RegexpParentName is regexp for parent name
var RegexpScriptName = regexp.MustCompile(`[^/]+/[^/]+/[^/]+.ank`)
RegexpScriptName is regexp for script name
var RegexpTemplateName = regexp.MustCompile(`[^/]+/[^/]+/[^/]+.tpl`)
RegexpTemplateName is regexp for template name
var RegexpVersion = regexp.MustCompile(`^(\d+(\.\d+)*)(-(` + RegexSuffixes + `)(-\d+)?)?$`)
RegexpVersion is a regexp for version
var TaskMap = make(map[string]TaskDesc)
TaskMap is a map that gives constructor for given task name
var Themes = map[string]*Theme{ "bee": { Title: []color.Attribute{color.FgYellow}, Ok: []color.Attribute{color.FgGreen, color.Bold}, Error: []color.Attribute{color.FgRed, color.Bold}, }, "rgb": { Title: []color.Attribute{color.FgBlue}, Ok: []color.Attribute{color.FgGreen, color.Bold}, Error: []color.Attribute{color.FgRed, color.Bold}, }, "red": { Title: []color.Attribute{color.FgRed}, Ok: []color.Attribute{color.FgRed, color.Bold}, Error: []color.Attribute{color.FgRed, color.Bold, color.ReverseVideo}, }, "green": { Title: []color.Attribute{color.FgGreen}, Ok: []color.Attribute{color.FgGreen, color.Bold}, Error: []color.Attribute{color.FgGreen, color.Bold, color.ReverseVideo}, }, "blue": { Title: []color.Attribute{color.FgBlue}, Ok: []color.Attribute{color.FgBlue, color.Bold}, Error: []color.Attribute{color.FgBlue, color.Bold, color.ReverseVideo}, }, "yellow": { Title: []color.Attribute{color.FgYellow}, Ok: []color.Attribute{color.FgYellow, color.Bold}, Error: []color.Attribute{color.FgYellow, color.Bold, color.ReverseVideo}, }, "magenta": { Title: []color.Attribute{color.FgMagenta}, Ok: []color.Attribute{color.FgMagenta, color.Bold}, Error: []color.Attribute{color.FgMagenta, color.Bold, color.ReverseVideo}, }, "cyan": { Title: []color.Attribute{color.FgCyan}, Ok: []color.Attribute{color.FgCyan, color.Bold}, Error: []color.Attribute{color.FgCyan, color.Bold, color.ReverseVideo}, }, "fire": { Title: []color.Attribute{color.FgRed}, Ok: []color.Attribute{color.FgGreen, color.Bold, color.Underline}, Error: []color.Attribute{color.FgRed, color.Bold, color.Underline}, }, "marine": { Title: []color.Attribute{color.FgBlue}, Ok: []color.Attribute{color.FgGreen, color.Bold, color.Underline}, Error: []color.Attribute{color.FgRed, color.Bold, color.Underline}, }, "nature": { Title: []color.Attribute{color.FgGreen}, Ok: []color.Attribute{color.FgGreen, color.Bold, color.Underline}, Error: []color.Attribute{color.FgRed, color.Bold, color.Underline}, }, "bold": { Title: []color.Attribute{color.FgYellow, color.Bold}, Ok: []color.Attribute{color.FgGreen, color.Underline, color.Bold}, Error: []color.Attribute{color.FgRed, color.Underline, color.Bold}, }, "reverse": { Title: []color.Attribute{color.ReverseVideo}, Ok: []color.Attribute{color.ReverseVideo, color.Bold}, Error: []color.Attribute{color.ReverseVideo, color.Bold}, }, }
Themes is a map of themes by name
Functions ¶
func AddBuiltin ¶
func AddBuiltin(desc BuiltinDesc)
AddBuiltin adds given builtin to the map - desc: builtin description
func AddTask ¶
func AddTask(task TaskDesc)
AddTask adds a task in the map: - task: description of the task
func ApplyThemeByName ¶
ApplyThemeByName applies named theme
func CheckTaskArgs ¶
CheckTaskArgs checks that task argument names don't collide with with the name of an existing task. For instance, a task can't have an argument named copy as a task named copy already exists. - map: the tasks map. - task: the task description. Return: an error if argument collides.
func CheckType ¶
func CheckType(field reflect.StructField, value interface{}) bool
CheckType checks that given value is compatible with field type - field: the field of the parameters as reflect.StructField - value: the value of the argument Return: a bool that tells if type is OK
func CopyValue ¶
CopyValue copy given value in another - orig: origin value - dest: destination value
func EvaluateTaskArgs ¶
func EvaluateTaskArgs(args TaskArgs, typ reflect.Type, context *Context) (result interface{}, err error)
EvaluateTaskArgs builds task arguments from task params and return it - args: task arguments parsed in build file - typ: the type of the arguments - context: the build context to evaluate arguments into Return: - result: as an interface{} - error: if something went wrong
func FieldIs ¶
func FieldIs(field reflect.StructField, quality string) bool
FieldIs tells if given field tag contains quality - field: the struct field - quality: the tested quality (such as "optional")
func FindParent ¶
FindParent finds a parent in given repository. - parent: the parent to find (such as "golang"). - repository: the NeON repository (defaults to '~/.neon') Return: - parent path relative to repository (such as "c4s4/build/golang.tpl"). - error if something went wrong.
func FindParents ¶
FindParents finds parent build files in given repository. - repository: the NeON repository (defaults to '~/.neon') Return: - list of parent build files relative to repo. - error if something went wrong.
func FindTemplate ¶
FindTemplate finds a template in given repository. - template: the template to find (such as "golang"). - repository: the NeON repository (defaults to '~/.neon') Return: - templates path relative to repo (such as "c4s4/build/golang.tpl"). - error if something went wrong.
func FindTemplates ¶
FindTemplates finds templates in given repository. - repository: the NeON repository (defaults to '~/.neon') Return: - list of template files relative to repo. - error if something went wrong.
func FormatScriptError ¶
FormatScriptError adds line and column numbers on parser or vm errors. - err: the error to process Return: the processed error
func FormatTarget ¶
FormatTarget generates target documentation on console - name: the name of the target - doc: the target documentation - depends: targets on which this one depends - length: title length to align help on targets Return: target as a string
func GetQuality ¶
func GetQuality(field reflect.StructField, quality string) string
GetQuality returns value of given quality - field: the field to examine - quality: quality to get
func HasField ¶
HasField tells if given structure has named field. - t: the type to check (must be a struct). - n: the name of the field to check as a string. Return: a boolean that tells if field exists.
func Info ¶
func Info(text string, args ...interface{})
Info prints an information message on console: - text: text to print (that might embed fields to print, such as "%s") - args: arguments for the text to print
func InfoBuiltin ¶
InfoBuiltin generates help on given builtin: - builtin: the name of the builtin to document. Return: builtin info as a string
func InfoBuiltins ¶
func InfoBuiltins() string
InfoBuiltins generates the list of all builtins on console Return: builtins list as a string
func InfoBuiltinsReference ¶
func InfoBuiltinsReference() string
InfoBuiltinsReference generates markdown reference for builtins on console. Return: reference as a string
func InfoParents ¶
InfoParents generates list of parent build files in repository: - repository: the NeON repository (defaults to '~/.neon') Return: parents info as a string
func InfoTask ¶
InfoTask generates help on given task. - task: name of the task to document. Return: task info as a string
func InfoTasks ¶
func InfoTasks() string
InfoTasks generates the list of tasks on the console. Return: list of tasks as a string
func InfoTasksReference ¶
func InfoTasksReference() string
InfoTasksReference generates markdown reference for tasks on console. Return: reference as a string
func InfoTemplates ¶
InfoTemplates generates list of templates in repository: - repository: the NeON repository (defaults to '~/.neon') Return: template info as a string
func InfoThemes ¶
func InfoThemes() string
InfoThemes generates the list of all available themes. Return: info about themes as a string
func InstallPlugin ¶
InstallPlugin installs given plugin in repository:
- plugin: the plugin name such as c4s4/build. First part us Github user name and second is repository name for the plugin.
- repository: plugin repository, defaults to ~/.neon.
Return: an error if something went wrong downloading plugin.
func IsExpression ¶
IsExpression tells if given string is an expression - s: the string to test Return: a bool that tells if the string is an expression
func IsValueOfType ¶
IsValueOfType tells if a value is of given type - value: the value to test as an interface{} - type: the type to check as a reflect.Type Return: a bool telling if value is of given type
func LinkPath ¶
LinkPath return the link path: - name: the name of the build file (such as 'c4s4/build/build.yml') - repository: the repository for plugins (defaults to '~/.neon') Return: link path (as '~/.neon/c4s4/build/build.yml')
func ListenPort ¶
ListenPort listens given port: - port: port to listen. Return: listener and error if any
func LoadBuiltins ¶
LoadBuiltins loads defined builtins in the VM - vm: the VM to load builtins into
func Message ¶
func Message(text string, args ...interface{})
Message prints a message on console: - text: text to print (that might embed fields to print, such as "%s") - args: arguments for the text to print
func ParseAttributes ¶
ParseAttributes parse attributes
func ParseConfiguration ¶
ParseConfiguration parses configuration field of the build: - object: the object to parse - build: build that is being constructed Return: an error if something went wrong
func ParseContext ¶
ParseContext parses context field of the build: - object: the object to parse - build: build that is being constructed Return: an error if something went wrong
func ParseDefault ¶
ParseDefault parses default field of the build: - object: the object to parse - build: build that is being constructed Return: an error if something went wrong
func ParseDoc ¶
ParseDoc parses doc field of the build: - object: the object to parse - build: build that is being constructed Return: an error if something went wrong
func ParseEnvironment ¶
ParseEnvironment parses environment field of the build: - object: the object to parse - build: build that is being constructed Return: an error if something went wrong
func ParseExpose ¶
ParseExpose parses list of targets to expose on the build: - object: the object to parse - build: build that is being constructed Return: an error if something went wrong
func ParseExtends ¶
ParseExtends parses extends field of the build: - object: the object to parse - build: build that is being constructed Return: an error if something went wrong
func ParseFields ¶
ParseFields parses build file fields: - object: the build as an object. - build: the build object. - repo: the repository. Return: an error if something went wrong.
func ParseProperties ¶
ParseProperties parses properties field of the build: - object: the object to parse - build: build that is being constructed Return: an error if something went wrong
func ParseRepository ¶
ParseRepository parses repository field of the build: - object: the object to parse - build: build that is being constructed - repo: repository location passed on command line Return: an error if something went wrong
func ParseShell ¶
ParseShell parses shell field of the build: - object: the object to parse - build: build that is being constructed Return: an error if something went wrong
func ParseSingleton ¶
ParseSingleton parses singleton field of the build: - object: the object to parse - build: build that is being constructed Return: an error if something went wrong
func ParseTargetDepends ¶
ParseTargetDepends parses target dependencies: - object: the target body as an interface - target: the target being parsed Return: an error if something went wrong
func ParseTargetDoc ¶
ParseTargetDoc parses documentation of the target: - object: body of the target as an interface - target: the target to document Return: an error if something went wrong
func ParseTargetSteps ¶
ParseTargetSteps parses steps of a target: - object: the target body as an interface - target: the target being parsed Return: an error if something went wrong
func ParseTargetUnless ¶
ParseTargetUnless parses unless clause of the target: - object: body of the target as an interface - target: the target to document Return: an error if something went wrong
func ParseTargets ¶
ParseTargets parses targets field of the build: - object: the object to parse - build: build that is being constructed Return: an error if something went wrong
func ParseVersion ¶
ParseVersion parses NeON version requirement of the build: - object: the object to parse - build: build that is being constructed Return: an error if something went wrong
func PrintError ¶
func PrintError(text string)
PrintError prints a red ERROR on the console followed with an explanatory text - text: the explanatory text to print
func PropertyToString ¶
PropertyToString returns a string representation of given property: - object: the body of the property as an interface - quotes: tells if we want quotes around strings Return: - string representation of the property - an error if something went wrong
func SetDirectories ¶
SetDirectories sets build and base directories: - build: the build directory. - base: the base directory. Return: an error if something went wrong.
func TemplatePath ¶
TemplatePath return the template path: - name: the name of the template (such as 'c4s4/build/golang.tpl') - repository: the repository for plugins (defaults to '~/.neon') Return: template path (as '~/.neon/c4s4/build/golang.tpl')
func Title ¶
func Title(text string)
Title prints a title on the console - text: text of the title to print
Types ¶
type Build ¶
type Build struct { File string Dir string Here string Default []string Doc string Repository string Singleton string Shell map[string][]string Scripts []string Extends []string Config []string Expose []string Properties util.Object Environment map[string]string Targets map[string]*Target Parents []*Build Root *Build Version string Template bool }
Build structure
func NewBuild ¶
NewBuild makes a build from a build file - file: path of the build file - base: base of the build - repo: repository location Return: - Pointer to the build - error if something went wrong
func (*Build) CheckVersion ¶
CheckVersion checks evaluates version expression to check that NeON version is OK
func (*Build) EnsureSingle ¶
EnsureSingle runs a TCP server on given port to ensure that a single instance is running on a machine. Fails if another instance is already running on same port. - context: build context Return: a listener and an error if another instance is running on same port
func (*Build) FormatTargets ¶
FormatTargets generates help on targets Return: targets as a string
func (*Build) GetDefault ¶
GetDefault returns default targets. If none is defined in build, return those from parent build files. Return: default targets a slice of strings
func (*Build) GetEnvironment ¶
GetEnvironment returns the build environment, including the environment inherited from parents Return: environment as a map with string keys and values
func (*Build) GetParentTarget ¶
GetParentTarget return parent target with given name. - name: the name of the target to run Return: - target: found parent target, nil if none was found - error: if something went wrong
func (*Build) GetParents ¶
GetParents returns parent build objects. Return list of build objects and an error if any.
func (*Build) GetProperties ¶
GetProperties returns build properties, including those inherited from parents Return: build properties as an Object
func (*Build) GetScripts ¶
GetScripts return a list of context scripts to run. Return: the list of context scripts
func (*Build) GetShell ¶
GetShell return shell for current os. Return: - shell as a slice of strings (such as ["sh", "-c"]) - error if something went wrong
func (*Build) GetTarget ¶
GetTarget return target with given name. If not defined in build, return target inherited from parent - name: the target name as a string Return: found target
func (*Build) GetTargets ¶
GetTargets returns build targets, including those inherited from parents Return: targets as a map of targets with their name as keys
func (*Build) Info ¶
Info generates information about build on console. - context: context of the build Return: build info as a string and an error if something went wrong
func (*Build) ParentPath ¶
ParentPath returns file path for plugin with given name. - name: the name of the plugin (as "c4s4/build/foo.yml" or "foo") Return: - the plugin path as a string (as /home/casa/.neon/c4s4/build/foo.yml) - error if something went wrong
func (*Build) Run ¶
Run runs given targets in a build context. If no target is given, runs default one. - context: the context to run into - targets: targets to run as a slice of strings Return: error if something went wrong
func (*Build) RunParentTarget ¶
RunParentTarget runs parent target with given name in a build context. - context: build context - name: the name of the target to run Return: - boolean: that tells if parent target was found - error: if something went wrong
func (*Build) RunTarget ¶
RunTarget runs given target in a build context. - context: build context - name: name of the target to run as a string Return: an error if something went wrong
func (*Build) ScriptPath ¶
ScriptPath returns file path for script with given name. - name: the name of the script (as "c4s4/build/foo.ank") Return: - the script path as a string (as /home/casa/.neon/c4s4/build/foo.ank) - error if something went wrong
func (*Build) SetCommandLineProperties ¶
SetCommandLineProperties defines properties passed on command line in the context. These properties overwrite those define in the build file. - props: properties as a YAML map Return: error if something went wrong
func (*Build) SetDir ¶
SetDir sets the build directory, propagating to parents - dir: build directory as a string
type BuiltinDesc ¶
BuiltinDesc is a descriptor for a builtin function
type Context ¶
Context is the context of the build - VM: Anko VM that holds build properties - Build: the current build - Index: tracks steps index while running build - Stack: tracks targets calls
func NewContext ¶
NewContext make a new build context Return: a pointer to the context
func (*Context) Copy ¶
Copy performs a deep copy of the Context Return: a pointer to the context copy
func (*Context) DelProperty ¶
DelProperty deletes given property - name: the name of the property Return: - an error if something went wrong
func (*Context) EvaluateEnvironment ¶
EvaluateEnvironment evaluates environment variables in the context Return: - evaluated environment as a slice of strings - an error if something went wrong
func (*Context) EvaluateExpression ¶
EvaluateExpression evaluate given expression in the context - expression: the expression to evaluate Return: - the return value of the expression - an error if something went wrong
func (*Context) EvaluateObject ¶
EvaluateObject recursively evaluates strings in a structure - object: the object to evaluate Return: - evaluated copy of object - an error if something went wrong
func (*Context) EvaluateString ¶
EvaluateString replaces '#{expression}' with the value of the expression - text: the string to evaluate Return: - evaluated string - an error if something went wrong
func (*Context) GetProperty ¶
GetProperty returns value of given property - name: the name of the property Return: - the value of the property - an error if something went wrong
func (*Context) InitProperties ¶
InitProperties sets build properties Return: an error if something went wrong
func (*Context) InitScripts ¶
InitScripts loads build scripts in context Return: an error if something went wrong
func (*Context) Message ¶
Message print a message on the console - text: the text to print on console - args: a slice of string arguments (as for fmt.Printf())
func (*Context) SetProperty ¶
SetProperty sets given property in context - name: the name of the property - value: the value of the property
type ScriptStep ¶
type ScriptStep struct {
Script string
}
ScriptStep is made of a string
func (ScriptStep) Run ¶
func (step ScriptStep) Run(context *Context) error
Run a script step using Anko VM. - context: the build context to run tha script Return: an error if something went wrong
type Stack ¶
type Stack struct {
Targets []*Target
}
Stack is structure for a stack. A stack lists all targets that run during a build.
func (*Stack) Contains ¶
Contains tells if the stack contains given target - target: target to test Returns: a boolean telling if target is in the stack
type Step ¶
Step has a Run() method
func NewScriptStep ¶
NewScriptStep makes a new script step - script: the script as a string - built step - error if something went wrong
func NewStep ¶
NewStep makes a new step - step: body of the step as an interface Return: - built step - error if something went wrong
func NewTaskStep ¶
NewTaskStep makes a task step - args: task args Return: - built step - error if something went wrong
type Steps ¶
type Steps []Step
Steps is a list of steps
type Target ¶
type Target struct { Build *Build Name string Doc string Depends []string Unless string Steps Steps }
Target is a structure for a target
type TaskArgs ¶
type TaskArgs map[interface{}]interface{}
TaskArgs is a type for task arguments as parsed in build file
type Version ¶
Version encapsulates a software version such as x.y.z
func NewVersion ¶
NewVersion builds a Version from its string representation