1
0
mirror of https://github.com/go-task/task.git synced 2024-12-12 10:45:49 +02:00

Add tests, documentation and changelog for #666

This commit is contained in:
Andrey Nering 2022-02-19 18:24:43 -03:00
parent e94d1b6b9f
commit 51c6ebcd4d
9 changed files with 65 additions and 1 deletions

View File

@ -1,5 +1,11 @@
# Changelog
## Unreleased
- Add `Taskfile.dist.yml` and `Taskfile.dist.yaml` to the supported file
name list. [Check out the documentation for more information](https://taskfile.dev/#/usage?id=supported-file-names).
([#498](https://github.com/go-task/task/issues/498), [#666](https://github.com/go-task/task/pull/666)).
## v3.10.0 - 2022-01-04
- A new `--list-all` (alias `-a`) flag is now available. It's similar to the

View File

@ -33,6 +33,20 @@ executable called must be available by the OS or in PATH.
If you omit a task name, "default" will be assumed.
## Supported file names
Task will look for the following file names, in order of priority:
- Taskfile.yml
- Taskfile.yaml
- Taskfile.dist.yml
- Taskfile.dist.yaml
The intention of having the `.dist` variants is to allow projects to have one
commited version (`.dist`) while still allowing individual users to override
the Taskfile by adding an additional `Taskfile.yml` (which would be on
`.gitignore`).
## Environment variables
### Task

View File

@ -856,6 +856,28 @@ func TestIncludesFromCustomTaskfile(t *testing.T) {
tt.Run(t)
}
func TestSupportedFileNames(t *testing.T) {
fileNames := []string{
"Taskfile.yml",
"Taskfile.yaml",
"Taskfile.dist.yml",
"Taskfile.dist.yaml",
}
for _, fileName := range fileNames {
t.Run(fileName, func(t *testing.T) {
tt := fileContentTest{
Dir: fmt.Sprintf("testdata/file_names/%s", fileName),
Target: "default",
TrimSpace: true,
Files: map[string]string{
"output.txt": "hello",
},
}
tt.Run(t)
})
}
}
func TestSummary(t *testing.T) {
const dir = "testdata/summary"

View File

@ -20,7 +20,12 @@ var (
// ErrIncludedTaskfilesCantHaveDotenvs is returned when a included Taskfile contains dotenvs
ErrIncludedTaskfilesCantHaveDotenvs = errors.New("task: Included Taskfiles can't have dotenv declarations. Please, move the dotenv declaration to the main Taskfile")
defaultTaskfiles = []string{"Taskfile.yml", "Taskfile.yaml", "Taskfile.dist.yml", "Taskfile.dist.yaml"}
defaultTaskfiles = []string{
"Taskfile.yml",
"Taskfile.yaml",
"Taskfile.dist.yml",
"Taskfile.dist.yaml",
}
)
// Taskfile reads a Taskfile for a given directory

1
testdata/file_names/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.txt

View File

@ -0,0 +1,4 @@
version: '3'
tasks:
default: echo "hello" > output.txt

View File

@ -0,0 +1,4 @@
version: '3'
tasks:
default: echo "hello" > output.txt

View File

@ -0,0 +1,4 @@
version: '3'
tasks:
default: echo "hello" > output.txt

View File

@ -0,0 +1,4 @@
version: '3'
tasks:
default: echo "hello" > output.txt