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:
parent
e94d1b6b9f
commit
51c6ebcd4d
@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# 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
|
## v3.10.0 - 2022-01-04
|
||||||
|
|
||||||
- A new `--list-all` (alias `-a`) flag is now available. It's similar to the
|
- A new `--list-all` (alias `-a`) flag is now available. It's similar to the
|
||||||
|
@ -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.
|
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
|
## Environment variables
|
||||||
|
|
||||||
### Task
|
### Task
|
||||||
|
22
task_test.go
22
task_test.go
@ -856,6 +856,28 @@ func TestIncludesFromCustomTaskfile(t *testing.T) {
|
|||||||
tt.Run(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) {
|
func TestSummary(t *testing.T) {
|
||||||
const dir = "testdata/summary"
|
const dir = "testdata/summary"
|
||||||
|
|
||||||
|
@ -20,7 +20,12 @@ var (
|
|||||||
// ErrIncludedTaskfilesCantHaveDotenvs is returned when a included Taskfile contains dotenvs
|
// 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")
|
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
|
// Taskfile reads a Taskfile for a given directory
|
||||||
|
1
testdata/file_names/.gitignore
vendored
Normal file
1
testdata/file_names/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.txt
|
4
testdata/file_names/Taskfile.dist.yaml/Taskfile.dist.yaml
vendored
Normal file
4
testdata/file_names/Taskfile.dist.yaml/Taskfile.dist.yaml
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
default: echo "hello" > output.txt
|
4
testdata/file_names/Taskfile.dist.yml/Taskfile.dist.yml
vendored
Normal file
4
testdata/file_names/Taskfile.dist.yml/Taskfile.dist.yml
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
default: echo "hello" > output.txt
|
4
testdata/file_names/Taskfile.yaml/Taskfile.yaml
vendored
Normal file
4
testdata/file_names/Taskfile.yaml/Taskfile.yaml
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
default: echo "hello" > output.txt
|
4
testdata/file_names/Taskfile.yml/Taskfile.yml
vendored
Normal file
4
testdata/file_names/Taskfile.yml/Taskfile.yml
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
default: echo "hello" > output.txt
|
Loading…
Reference in New Issue
Block a user