model

package
v0.0.0-...-30a59cf Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCirculatedDependency = errors.New("task dependency is circulated")

Functions

This section is empty.

Types

type Condition

type Condition interface {
	IsEnable(context.Context) (bool, error)
}

type Document

type Document struct {
	Title       string                  `json:"title,omitempty"`
	Description string                  `json:"description,omitempty"`
	Rootdir     string                  `json:"rootdir"`
	Tasks       map[string]DocumentTask `json:"tasks,omitempty"`
	GlobalEnvs  map[string]string       `json:"global_envs,omitempty"`
}

func NewDocument

func NewDocument(ctx context.Context, options ...NewDocumentOption) (Document, error)

type DocumentConfig

type DocumentConfig struct {
	Document         Document
	ExecPathResolver map[string]ExecConfig
}

type DocumentTask

type DocumentTask struct {
	Parent      *Document            `json:"-"`
	Title       string               `json:"omitempty"`
	Call        string               `json:"call"`
	Description string               `json:"description,omitempty"`
	Scripts     []DocumentTaskScript `json:"scripts"`
	Envs        map[string]string    `json:"envs,omitempty"`
	Skips       TaskSkipCondition    `json:"skips,omitempty"`
	Requires    TaskRequireCondition `json:"requires,omitempty"`
	DependTasks []string             `json:"depend_tasks,omitempty"`
}

type DocumentTaskScript

type DocumentTaskScript struct {
	Config ExecConfig
	Script string
}

type ExecConfig

type ExecConfig struct {
	ExecPath string   `json:"exec_path"`
	CmdOpt   string   `json:"cmd_opt,omitempty"`
	Args     []string `json:"args,omitempty"`
}

type NewDocumentOption

type NewDocumentOption func(ctx context.Context, d *DocumentConfig) error

func NewDocOptionRootDir

func NewDocOptionRootDir(dirname string) NewDocumentOption

type TaskFileNotChangedCondition

type TaskFileNotChangedCondition struct {
	Paths   setString `json:"paths,omitempty"`
	Ignores setString `json:"ignores,omitempty"`
	MD5     string    `json:"md5,omitempty"`
}

func (*TaskFileNotChangedCondition) IsEqualRule

func (cond *TaskFileNotChangedCondition) IsEqualRule(paths []string, ignores []string) bool

type TaskRequireCondition

type TaskRequireCondition struct {
	ExistPaths []string `json:"exist_paths,omitempty"`
}

type TaskSkipCondition

type TaskSkipCondition struct {
	ExistPaths      []string                      `json:"exist_paths,omitempty"`
	NotChangedPaths []TaskFileNotChangedCondition `json:"not_changed_paths,omitempty"`
}

Jump to

Keyboard shortcuts

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