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

remove support for TOML and JSON

ref #34
This commit is contained in:
Andrey Nering 2017-07-03 21:20:58 -03:00
parent b8fe8d465e
commit e1fc3aa4fb
4 changed files with 2 additions and 42 deletions

View File

@ -39,9 +39,7 @@ your `PATH`. DEB and RPM packages are also available.
## Usage
Create a file called `Taskfile.yml` in the root of the project.
(`Taskfile.toml` and `Taskfile.json` are also supported, but YAML is used in
the documentation). The `cmds` attribute should contains the commands of a
task:
The `cmds` attribute should contains the commands of a task:
```yml
build:
@ -256,7 +254,7 @@ setvar:
The above sample saves the path into a new variable which is then again echoed.
You can use environment variables, task level variables and a file called
`Taskvars.yml` (or `Taskvars.toml` or `Taskvars.json`) as source of variables.
`Taskvars.yml` as source of variables.
They are evaluated in the following order:

View File

@ -1,11 +0,0 @@
{
"hello": {
"cmds": [
"echo \"I am going to write a file named 'output.txt' now.\"",
"echo \"hello\" > output.txt"
],
"generates": [
"output.txt"
]
}
}

View File

@ -1,6 +0,0 @@
[hello]
cmds = [
"echo \"I am going to write a file named 'output.txt' now.\"",
"echo \"hello\" > output.txt"
]
generates = ["output.txt"]

View File

@ -1,13 +1,11 @@
package task
import (
"encoding/json"
"fmt"
"io/ioutil"
"path/filepath"
"runtime"
"github.com/BurntSushi/toml"
"github.com/imdario/mergo"
"gopkg.in/yaml.v2"
)
@ -43,12 +41,6 @@ func (e *Executor) readTaskfileData(path string) (tasks map[string]*Task, err er
if b, err := ioutil.ReadFile(path + ".yml"); err == nil {
return tasks, yaml.Unmarshal(b, &tasks)
}
if b, err := ioutil.ReadFile(path + ".json"); err == nil {
return tasks, json.Unmarshal(b, &tasks)
}
if b, err := ioutil.ReadFile(path + ".toml"); err == nil {
return tasks, toml.Unmarshal(b, &tasks)
}
return nil, taskFileNotFound{path}
}
@ -59,19 +51,6 @@ func (e *Executor) readTaskvarsFile() error {
if err := yaml.Unmarshal(b, &e.taskvars); err != nil {
return err
}
return nil
}
if b, err := ioutil.ReadFile(file + ".json"); err == nil {
if err := json.Unmarshal(b, &e.taskvars); err != nil {
return err
}
return nil
}
if b, err := ioutil.ReadFile(file + ".toml"); err == nil {
if err := toml.Unmarshal(b, &e.taskvars); err != nil {
return err
}
return nil
}
return nil
}