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

Updating version checking

This commit is contained in:
Ross Hammermeister 2021-07-28 13:50:29 -06:00 committed by Andrey Nering
parent 2da38a5bdc
commit 3e16ca37bc
3 changed files with 16 additions and 12 deletions

View File

@ -468,7 +468,7 @@ Supported values for `run`
passed into the task
```yaml
version: '3'
version: '3.7'
tasks:
default:
cmds:

24
task.go
View File

@ -152,8 +152,8 @@ func (e *Executor) Setup() error {
v = 2.6
}
if v > 3.0 {
return fmt.Errorf(`task: Taskfile versions greater than v3.0 not implemented in the version of Task`)
if v > 3.7 {
return fmt.Errorf(`task: Taskfile versions greater than v3.7 not implemented in the version of Task`)
}
// Color available only on v3
@ -227,13 +227,6 @@ func (e *Executor) Setup() error {
}
}
if v < 3 && e.Taskfile.Run != "" {
return errors.New(`task: Setting the "run" type is only available starting on Taskfile version v3`)
}
if e.Taskfile.Run == "" {
e.Taskfile.Run = "always"
}
if v <= 2.1 {
err := errors.New(`task: Taskfile option "ignore_error" is only available starting on Taskfile version v2.1`)
@ -267,13 +260,24 @@ func (e *Executor) Setup() error {
if err != nil {
return err
}
}
if v < 3.7 {
if e.Taskfile.Run != "" {
return errors.New(`task: Setting the "run" type is only available starting on Taskfile version v3.7`)
}
for _, task := range e.Taskfile.Tasks {
if task.Run != "" {
return errors.New(`task: Setting the "run" type is only available starting on Taskfile version v3`)
return errors.New(`task: Setting the "run" type is only available starting on Taskfile version v3.7`)
}
}
}
if e.Taskfile.Run == "" {
e.Taskfile.Run = "always"
}
e.execution = make(map[string]context.Context)
e.taskCallCount = make(map[string]*int32, len(e.Taskfile.Tasks))

View File

@ -1,4 +1,4 @@
version: '3'
version: '3.7'
run: when_changed
tasks: