1
0
mirror of https://github.com/go-task/task.git synced 2025-11-25 22:32:55 +02:00

Refactor and move logic of reading Taskfiles to its own package

Idea to making things easier to start implementing #98
This commit is contained in:
Andrey Nering
2018-07-22 16:05:47 -03:00
parent 13f60bae41
commit 9f294b4d10
5 changed files with 108 additions and 82 deletions

11
task.go
View File

@@ -14,6 +14,7 @@ import (
"github.com/go-task/task/internal/logger"
"github.com/go-task/task/internal/output"
"github.com/go-task/task/internal/taskfile"
"github.com/go-task/task/internal/taskfile/read"
"github.com/go-task/task/internal/taskfile/version"
"github.com/Masterminds/semver"
@@ -21,8 +22,6 @@ import (
)
const (
// TaskFilePath is the default Taskfile
TaskFilePath = "Taskfile"
// MaximumTaskCall is the max number of times a task can be called.
// This exists to prevent infinite loops on cyclic dependencies
MaximumTaskCall = 100
@@ -77,7 +76,13 @@ func (e *Executor) Run(calls ...taskfile.Call) error {
// Setup setups Executor's internal state
func (e *Executor) Setup() error {
if err := e.readTaskfile(); err != nil {
var err error
e.Taskfile, err = read.Taskfile(e.Dir)
if err != nil {
return err
}
e.taskvars, err = read.Taskvars(e.Dir)
if err != nil {
return err
}