src

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2013 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MissingTask = errors.New("Task doesn't exist")
	TaskExists  = errors.New("Task with same name exists")
)

Functions

func Debug

func Debug(fn func())

Run the specified function only if the DEBUG environment var is set

func Debugf

func Debugf(args ...interface{})

Run fmt.Printf on the passed in arguments only if the DEBUG environment is set

Types

type Env

type Env struct {
	// contains filtered or unexported fields
}

func NewEnv

func NewEnv() *Env

func (*Env) AddTask

func (e *Env) AddTask(t Task)

func (*Env) Child

func (e *Env) Child() *Env

func (*Env) ExportedTasks

func (e *Env) ExportedTasks() []string

func (*Env) GetExportedTask

func (e *Env) GetExportedTask(name string) (Task, *Env)

func (*Env) GetTask

func (e *Env) GetTask(name string) (Task, *Env)

func (*Env) GetVar

func (e *Env) GetVar(k string) interface{}

func (*Env) Id

func (e *Env) Id() string

func (*Env) IsRoot

func (e *Env) IsRoot() bool

func (*Env) SetVar

func (e *Env) SetVar(k string, v interface{})

func (*Env) Tasks

func (e *Env) Tasks() []string

type Namespace

type Namespace interface {
	Id() string
	RootEnv() *Env
	Tasks() []string
	GetTask(string) Task
}

type RunContext

type RunContext interface {
	In() io.Reader
	Out() io.Writer
	Err() io.Writer
	Run(Task) error
	Clone(io.Reader, io.Writer, io.Writer, *Env) RunContext
	Env() *Env
}

type Runtime

type Runtime struct {
	Watcher Watcher
	// contains filtered or unexported fields
}

func LoadRuntime

func LoadRuntime(path string, in io.Reader, out, err io.Writer) (*Runtime, error)

func NewRuntime

func NewRuntime(in io.Reader, out, err io.Writer) *Runtime

func (*Runtime) Err

func (r *Runtime) Err() io.Writer

func (*Runtime) In

func (r *Runtime) In() io.Reader

func (*Runtime) Out

func (r *Runtime) Out() io.Writer

func (*Runtime) RootNs

func (r *Runtime) RootNs() Namespace

func (*Runtime) Run

func (r *Runtime) Run(task string) error

type Task

type Task interface {
	Name() string
	Type() string
	Description() string
	Run(RunContext) error
	Export() []map[string]interface{}
	Var() string
	Env() *Env
}

type Watcher

type Watcher interface {
	BeforeRun(*Runtime, *Env, Task) chan bool
	AfterRun(*Runtime, *Env, Task) chan bool
}

Jump to

Keyboard shortcuts

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