runtime

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2020 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsErrTaskNotExist

func IsErrTaskNotExist(err error) bool

Types

type Context

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

func NewContext

func NewContext(pkg *Package, host string, output io.Writer) (*Context, error)

func (*Context) Close

func (ctx *Context) Close() error

func (*Context) Execute

func (ctx *Context) Execute(cmd string) error

func (*Context) IsLogin

func (ctx *Context) IsLogin() bool

func (*Context) Login

func (ctx *Context) Login() error

func (*Context) Upload

func (ctx *Context) Upload(files ...string) error

type ErrTaskNotExist

type ErrTaskNotExist struct {
	TaskName string
}

func (ErrTaskNotExist) Error

func (err ErrTaskNotExist) Error() string

type Package

type Package struct {
	Version string   `yaml:"version"`
	Name    string   `yaml:"name"`
	Imports []string `yaml:"imports"`
	Tasks   []Task   `yaml:"tasks"`

	Main struct {
		Hosts []string `yaml:"hosts"`
		Tasks []string `yaml:"tasks"`
	} `yaml:"main"`
	// contains filtered or unexported fields
}

Package represents a package

func NewPackageFromFile

func NewPackageFromFile(fPath string) (*Package, error)

NewPackageFromFile load a package from file

func (*Package) FindTask

func (pkg *Package) FindTask(taskname string) (*Task, error)

FindTask find a task from the package

func (*Package) Run

func (pkg *Package) Run(hosts []string, tasks []string) error

Run the package with special hosts and tasks

type Step

type Step struct {
	For  string // for for statement
	Type string // task, if blank it means remote shell
	Cmd  string
}

Step represents a task step

func (*Step) ExplainCmd added in v0.0.3

func (step *Step) ExplainCmd(args map[string]interface{}) (string, error)

ExplainCmd render the commond with args

func (*Step) Run

func (step *Step) Run(ctx *Context, args map[string]interface{}) error

Run executes a step

func (*Step) UnmarshalYAML

func (step *Step) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler interface

type Task

type Task struct {
	Name  string
	Args  []string `yaml:"args"`
	Steps []Step   `yaml:"steps"`
	Pkg   *Package `yaml:"-"`
}

Task represents a task on a module

func (*Task) Run

func (task *Task) Run(host string, args ...string) error

Run run a task's steps

func (*Task) RunWithContext added in v0.0.3

func (task *Task) RunWithContext(ctx *Context, args ...string) error

RunWithContext run task with derived ctx

type Work added in v0.0.3

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

func (*Work) Run added in v0.0.3

func (w *Work) Run() error

Jump to

Keyboard shortcuts

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