1
0
mirror of https://github.com/go-task/task.git synced 2025-05-31 23:19:42 +02:00

Rename TaskFile to Taskfile

This commit is contained in:
Evgeny Abramovich 2020-02-12 10:42:00 +03:00
parent d567e23e50
commit a3464068bd
4 changed files with 13 additions and 13 deletions

View File

@ -3,21 +3,21 @@ package taskfile
import "errors"
var (
// ErrCantUnmarshalIncludedTaskFile is returned for invalid var YAML.
ErrCantUnmarshalIncludedTaskFile = errors.New("task: can't unmarshal included value")
// ErrCantUnmarshalIncludedTaskfile is returned for invalid var YAML.
ErrCantUnmarshalIncludedTaskfile = errors.New("task: can't unmarshal included value")
)
// IncludedTaskFile represents information about included tasksfile
type IncludedTaskFile struct {
// IncludedTaskfile represents information about included tasksfile
type IncludedTaskfile struct {
Taskfile string
Dir string
}
// IncludedTaskFiles represents information about included tasksfiles
type IncludedTaskFiles = map[string]IncludedTaskFile
// IncludedTaskfiles represents information about included tasksfiles
type IncludedTaskfiles = map[string]IncludedTaskfile
// UnmarshalYAML implements yaml.Unmarshaler interface
func (it *IncludedTaskFile) UnmarshalYAML(unmarshal func(interface{}) error) error {
func (it *IncludedTaskfile) UnmarshalYAML(unmarshal func(interface{}) error) error {
var str string
if err := unmarshal(&str); err == nil {
it.Taskfile = str
@ -34,5 +34,5 @@ func (it *IncludedTaskFile) UnmarshalYAML(unmarshal func(interface{}) error) err
return nil
}
return ErrCantUnmarshalIncludedTaskFile
return ErrCantUnmarshalIncludedTaskfile
}

View File

@ -22,7 +22,7 @@ func Merge(t1, t2 *Taskfile, namespaces ...string) error {
}
if t1.Includes == nil {
t1.Includes = make(IncludedTaskFiles)
t1.Includes = make(IncludedTaskfiles)
}
for k, v := range t2.Includes {
t1.Includes[k] = v

View File

@ -47,8 +47,8 @@ func Taskfile(dir string, entrypoint string) (*taskfile.Taskfile, error) {
}
includedTaskDirectory := filepath.Dir(path)
includedTaskFileName := strings.TrimSuffix(filepath.Base(path), filepath.Ext(path))
path = filepath.Join(includedTaskDirectory, fmt.Sprintf("%s_%s.yml", includedTaskFileName, runtime.GOOS))
includedTaskfileName := strings.TrimSuffix(filepath.Base(path), filepath.Ext(path))
path = filepath.Join(includedTaskDirectory, fmt.Sprintf("%s_%s.yml", includedTaskfileName, runtime.GOOS))
if _, err = os.Stat(path); err == nil {
osIncludedTaskfile, err := readTaskfile(path)
if err != nil {

View File

@ -6,7 +6,7 @@ type Taskfile struct {
Expansions int
Output string
Method string
Includes IncludedTaskFiles
Includes IncludedTaskfiles
Vars Vars
Env Vars
Tasks Tasks
@ -20,7 +20,7 @@ func (tf *Taskfile) UnmarshalYAML(unmarshal func(interface{}) error) error {
Expansions int
Output string
Method string
Includes IncludedTaskFiles
Includes IncludedTaskfiles
Vars Vars
Env Vars
Tasks Tasks