1
0
mirror of https://github.com/go-task/task.git synced 2025-11-23 22:24:45 +02:00

func isUpToDate should be bound to Task struct

This commit is contained in:
Andrey Nering
2017-07-30 19:45:01 -03:00
parent 70ef9fbcfe
commit f54dde4f78
3 changed files with 19 additions and 26 deletions

View File

@@ -228,7 +228,7 @@ func (e *Executor) handleDynamicVariableContent(v Var) (string, error) {
// CompiledTask returns a copy of a task, but replacing
// variables in almost all properties using the Go template package
func (t *Task) CompiledTask(vars Vars) (*Task, error) {
func (t *Task) CompiledTask(dir string, vars Vars) (*Task, error) {
r := varReplacer{vars: vars}
new := Task{
@@ -242,6 +242,9 @@ func (t *Task) CompiledTask(vars Vars) (*Task, error) {
Env: r.replaceVars(t.Env),
Silent: t.Silent,
}
if dir != "" && !filepath.IsAbs(new.Dir) {
new.Dir = filepath.Join(dir, new.Dir)
}
if len(t.Cmds) > 0 {
new.Cmds = make([]*Cmd, len(t.Cmds))