Documentation ¶
Index ¶
- Variables
- func Bash(script string, wd ...In) error
- func BashOutput(script string, wd ...In) (string, error)
- func Glob(patterns []string) ([]*FileAsset, []*RegexpInfo, error)
- func Globexp(glob string) *regexp.Regexp
- func Godo(tasksFunc func(*Project))
- func Inside(dir string, lambda func()) error
- func Run(commandstr string, wd ...In) error
- func RunOutput(commandstr string, wd ...In) (string, error)
- func Start(commandstr string, wd ...In) error
- type Context
- type D
- type Debounce
- type Dependencies
- type FileAsset
- type In
- type M
- type Project
- func (project *Project) Define(fn func(*Project))
- func (project *Project) Run(name string)
- func (project *Project) Task(name string, args ...interface{}) *Task
- func (project *Project) Usage()
- func (project *Project) Use(namespace string, tasksFunc func(*Project))
- func (project *Project) Watch(names []string, isParent bool)
- type RegexpInfo
- type Task
- type W
- type Watch
Constants ¶
This section is empty.
Variables ¶
var DebounceMs int64
DebounceMs is the default time (1500 ms) to debounce task events in watch mode.
var Env string
Env is the default environment to use for all commands. That is, the effective environment for all commands is the merged set of (parent environment, Env, func specified environment). Whitespace or newline separate key value pairs. $VAR interpolation is allowed.
Env = "GOOS=linux GOARCH=amd64" Env = `
GOOS=linux GOPATH=./vendor:$GOPATH
`
var InheritParentEnv bool
InheritParentEnv whether to inherit parent's environment
var Version = "1.1.0"
Version is the current version
Functions ¶
func Bash ¶ added in v1.1.0
Bash executes a bash script (string) with an option to set the working directory.
func BashOutput ¶ added in v1.1.0
BashOutput is the same as Bash and it captures stdout and stderr.
func Glob ¶
func Glob(patterns []string) ([]*FileAsset, []*RegexpInfo, error)
Glob returns files and dirctories that match patterns. Patterns must use slashes, even Windows.
Special chars.
/**/ - match zero or more directories {a,b} - match a or b, no spaces * - match any non-separator char ? - match a single non-separator char **/ - match any directory, start of pattern only /** - match any this directory, end of pattern only ! - removes files from resultset, start of pattern only
func Globexp ¶
Globexp builds a regular express from from extended glob pattern and then returns a Regexp object from the pattern.
func Inside ¶ added in v1.1.0
Inside temporarily changes the working directory and restores it when lambda finishes.
Types ¶
type Context ¶
type Context struct { // Task is the currently running task. Task *Task // FileEvent is an event from the watcher with change details. FileEvent *watcher.FileEvent }
Context is the data passed to a task.
type Debounce ¶
type Debounce int64
Debounce is the number of milliseconds before a task can run again.
type In ¶ added in v1.1.0
type In []string
In is used by Bash, Run and Start to set the working directory
type Project ¶
type Project struct { sync.Mutex Tasks map[string]*Task Namespace map[string]*Project // contains filtered or unexported fields }
Project is a container for tasks.
func NewProject ¶
NewProject creates am empty project ready for tasks.
type RegexpInfo ¶
RegexpInfo contains additional info about the Regexp created by a glob pattern.
type Task ¶
type Task struct { Name string Description string Dependencies []string Handler func() ContextHandler func(*Context) // Watches are the files are watched. On change the task is rerun. For example `**/*.less` // Usually Watches and Sources are the same. WatchFiles []*FileAsset WatchGlobs []string WatchRegexps []*RegexpInfo // computed based on dependencies EffectiveWatchRegexps []*RegexpInfo EffectiveWatchGlobs []string // Complete indicates whether this task has already ran. This flag is // ignored in watch mode. Complete bool Debounce int64 RunOnce bool }
A Task is an operation performed on a user's project directory.