ox

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCircularDependency = errors.New("circular dependency")
View Source
var ErrTaskNotFound = errors.New("task not found")

Functions

func GetCmdFromVars

func GetCmdFromVars(vars map[string]string, cmd string) (string, error)

func ToFile added in v0.8.0

func ToFile(elk *Elk, filePath string) error

ToFile saves an elk object to a file

Types

type Dep

type Dep struct {
	Name        string `yaml:"name"`
	Detached    bool   `yaml:"detached"`
	IgnoreError bool   `yaml:"ignore_error,omitempty"`
}

type Elk

type Elk struct {
	Version string
	Env     map[string]string `yaml:"env"`
	Vars    map[string]string `yaml:"vars"`
	EnvFile string            `yaml:"env_file"`
	Tasks   map[string]Task
	// contains filtered or unexported fields
}

Elk is the structure of the application

func FromFile

func FromFile(filePath string) (*Elk, error)

FromFile loads an elk object from a file

func (*Elk) Build

func (e *Elk) Build() error

Build compiles the ox structure and validates its integrity

func (*Elk) GetFilePath added in v0.6.0

func (e *Elk) GetFilePath() string

GetFilePath get path used to create the object

func (*Elk) GetTask

func (e *Elk) GetTask(name string) (*Task, error)

GetTask Get a task object by its name

func (*Elk) HasCircularDependency

func (e *Elk) HasCircularDependency(name string, visitedNodes ...string) error

HasCircularDependency checks if a task has a circular dependency

func (*Elk) HasTask

func (e *Elk) HasTask(name string) bool

HasTask return a boolean if the incoming event exist

func (*Elk) LoadEnvFile

func (e *Elk) LoadEnvFile() error

LoadEnvFile Log to the variable env the values

func (*Elk) SetFilePath added in v0.6.0

func (e *Elk) SetFilePath(filepath string)

SetFilePath set the path used to create the object

type Log added in v0.5.0

type Log struct {
	Out    string `yaml:"out"`
	Format string `yaml:"format"`
	Err    string `yaml:"error"`
}

type Task

type Task struct {
	Title       string            `yaml:"title"`
	Tags        []string          `yaml:"tags"`
	Cmds        []string          `yaml:"cmds"`
	Env         map[string]string `yaml:"env,omitempty"`
	Vars        map[string]string `yaml:"vars,omitempty"`
	EnvFile     string            `yaml:"env_file,omitempty"`
	Description string            `yaml:"description,omitempty"`
	Dir         string            `yaml:"dir,omitempty"`
	Log         Log               `yaml:"log,omitempty"`
	Sources     string            `yaml:"sources,omitempty"`
	Deps        []Dep             `yaml:"deps,omitempty"`
	IgnoreError bool              `yaml:"ignore_error,omitempty"`
}

Task is the data structure for the task to run

func (*Task) GetEnvs

func (t *Task) GetEnvs() []string

GetEnvs return env variables as string

func (*Task) LoadEnvFile

func (t *Task) LoadEnvFile() error

LoadEnvFile Log to the variable env the values

type Vars

type Vars struct {
	Map map[string]string
	Cmd string
}

func (*Vars) Process

func (v *Vars) Process(cmd string) (string, error)

func (*Vars) Write

func (v *Vars) Write(data []byte) (n int, err error)

Jump to

Keyboard shortcuts

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