Documentation
¶
Index ¶
- func GetFeaturesFromTasks(tasks []*Task) autoenv.FeatureSet
- type ActionResult
- type Context
- type Task
- type TaskAction
- type TaskConfig
- func (c *TaskConfig) GetBooleanPropertyDefault(name string, defaultValue bool) (bool, error)
- func (c *TaskConfig) GetListOfStrings() ([]string, error)
- func (c *TaskConfig) GetListOfStringsPropertyDefault(name string, defaultValue []string) ([]string, error)
- func (c *TaskConfig) GetStringProperty(name string) (string, error)
- func (c *TaskConfig) GetStringPropertyAllowSingle(name string) (string, error)
- func (c *TaskConfig) GetStringPropertyDefault(name string, defaultValue string) (string, error)
- func (c *TaskConfig) IsHash() bool
- type TaskDefinition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFeaturesFromTasks ¶
func GetFeaturesFromTasks(tasks []*Task) autoenv.FeatureSet
Types ¶
type ActionResult ¶
func ActionFailed ¶
func ActionFailed(errorMessage string, args ...interface{}) *ActionResult
func ActionNeeded ¶
func ActionNeeded(message string, args ...interface{}) *ActionResult
func ActionNotNeeded ¶
func ActionNotNeeded() *ActionResult
type Context ¶
type Context struct {
Project *project.Project
UI *termui.UI
Cfg *config.Config
Env *env.Env
Features autoenv.FeatureSet
}
Context provides the context in which a Task run
type Task ¶
type Task struct {
*TaskDefinition
Info string
Actions []TaskAction
}
Task represents a task created by a taskDefinition.parser and specified by the TaskInfo
func GetTasksFromProject ¶
func NewTaskFromDefinition ¶
func (*Task) AddAction ¶
func (t *Task) AddAction(action TaskAction)
func (*Task) AddActionWithBuilder ¶
type TaskAction ¶
type TaskAction interface {
Description() string
Needed(*context.Context) *ActionResult
Run(*context.Context) error
Feature() *autoenv.FeatureInfo
}
type TaskConfig ¶
type TaskConfig struct {
// contains filtered or unexported fields
}
TaskConfig represents a task as defined in dev.yml
func NewTaskConfig ¶
func NewTaskConfig(definition interface{}) (*TaskConfig, error)
func (*TaskConfig) GetBooleanPropertyDefault ¶
func (c *TaskConfig) GetBooleanPropertyDefault(name string, defaultValue bool) (bool, error)
GetBooleanPropertyDefault expects the payload to be a hash, returns the value as a boolean for the name specified. Or returns the default value specified if the payload is nil.
YAML Example:
- TASKNAME: PROPERTYNAME: on
func (*TaskConfig) GetListOfStrings ¶
func (c *TaskConfig) GetListOfStrings() ([]string, error)
GetListOfStrings expects the payload to be a list of string, returns it.
YAML Example:
- TASKNAME:
- foo
- bar
func (*TaskConfig) GetListOfStringsPropertyDefault ¶
func (c *TaskConfig) GetListOfStringsPropertyDefault(name string, defaultValue []string) ([]string, error)
GetListOfStringsPropertyDefault expects the payload to be a list of string, returns it. Or returns the default value specified if the payload is nil.
YAML Example:
- TASKNAME:
- foo
- bar
func (*TaskConfig) GetStringProperty ¶
func (c *TaskConfig) GetStringProperty(name string) (string, error)
GetStringProperty expects the payload to be a hash of string, returns the value for the name specified.
YAML Example:
- TASKNAME: PROPERTYNAME: foo
func (*TaskConfig) GetStringPropertyAllowSingle ¶
func (c *TaskConfig) GetStringPropertyAllowSingle(name string) (string, error)
GetStringPropertyAllowSingle expects one of those two situations: 1. the payload is a string, returns it directly 2. the payload is a hash of string, returns the value for the name specified
YAML Example:
- TASKNAME: foo
or
- TASKNAME: PROPERTYNAME: foo
func (*TaskConfig) GetStringPropertyDefault ¶
func (c *TaskConfig) GetStringPropertyDefault(name string, defaultValue string) (string, error)
GetStringPropertyDefault expects the payload to be a hash of string, returns the value for the name specified. Or returns the default value specified if the payload is nil.
YAML Example:
- TASKNAME: PROPERTYNAME: foo
func (*TaskConfig) IsHash ¶
func (c *TaskConfig) IsHash() bool
IsHash returns a boolean indicating whether the payload is a hash
type TaskDefinition ¶
type TaskDefinition struct {
Key string // the value used in dev.yml to identify a task
Name string // the displayed name of the task
RequiredTask string // another task that should be declared before this task
Parser taskParser // the config parser for this task
OSRequirement string // The platform this task can run on. "debian", "macos"
}
func Register ¶
func Register(key, name string, parserFunc taskParser) *TaskDefinition
func (*TaskDefinition) SetOSRequirement ¶
func (t *TaskDefinition) SetOSRequirement(requirement string) *TaskDefinition
func (*TaskDefinition) SetRequiredTask ¶
func (t *TaskDefinition) SetRequiredTask(name string) *TaskDefinition