mirror of
https://github.com/go-task/task.git
synced 2025-02-09 13:47:06 +02:00
Updating version checking
This commit is contained in:
parent
2da38a5bdc
commit
3e16ca37bc
@ -468,7 +468,7 @@ Supported values for `run`
|
|||||||
passed into the task
|
passed into the task
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
version: '3'
|
version: '3.7'
|
||||||
tasks:
|
tasks:
|
||||||
default:
|
default:
|
||||||
cmds:
|
cmds:
|
||||||
|
24
task.go
24
task.go
@ -152,8 +152,8 @@ func (e *Executor) Setup() error {
|
|||||||
v = 2.6
|
v = 2.6
|
||||||
}
|
}
|
||||||
|
|
||||||
if v > 3.0 {
|
if v > 3.7 {
|
||||||
return fmt.Errorf(`task: Taskfile versions greater than v3.0 not implemented in the version of Task`)
|
return fmt.Errorf(`task: Taskfile versions greater than v3.7 not implemented in the version of Task`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Color available only on v3
|
// 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 {
|
if v <= 2.1 {
|
||||||
err := errors.New(`task: Taskfile option "ignore_error" is only available starting on Taskfile version v2.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 {
|
if err != nil {
|
||||||
return err
|
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 {
|
for _, task := range e.Taskfile.Tasks {
|
||||||
if task.Run != "" {
|
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.execution = make(map[string]context.Context)
|
||||||
|
|
||||||
e.taskCallCount = make(map[string]*int32, len(e.Taskfile.Tasks))
|
e.taskCallCount = make(map[string]*int32, len(e.Taskfile.Tasks))
|
||||||
|
2
testdata/run/Taskfile.yml
vendored
2
testdata/run/Taskfile.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
version: '3'
|
version: '3.7'
|
||||||
run: when_changed
|
run: when_changed
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user