mirror of
https://github.com/go-task/task.git
synced 2025-06-04 23:38:05 +02:00
parent
59d2733b88
commit
ec4cd5ed48
@ -2,9 +2,12 @@
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
- Fix the `.task` directory being created in the task directory instead of the
|
||||||
|
Taskfile directory
|
||||||
|
([#247](https://github.com/go-task/task/issues/247)).
|
||||||
- Fix a bug where dynamic variables (those declared with `sh:`) were not
|
- Fix a bug where dynamic variables (those declared with `sh:`) were not
|
||||||
running in the task directory when the task has a custom dir or it was
|
running in the task directory when the task has a custom dir or it was
|
||||||
in an included taskfile
|
in an included Taskfile
|
||||||
([#384](https://github.com/go-task/task/issues/384)).
|
([#384](https://github.com/go-task/task/issues/384)).
|
||||||
- The watch feature (via the `--watch` flag) got a few different bug fixes and
|
- The watch feature (via the `--watch` flag) got a few different bug fixes and
|
||||||
should be more stable now
|
should be more stable now
|
||||||
|
@ -14,7 +14,8 @@ import (
|
|||||||
// Checksum validades if a task is up to date by calculating its source
|
// Checksum validades if a task is up to date by calculating its source
|
||||||
// files checksum
|
// files checksum
|
||||||
type Checksum struct {
|
type Checksum struct {
|
||||||
Dir string
|
BaseDir string
|
||||||
|
TaskDir string
|
||||||
Task string
|
Task string
|
||||||
Sources []string
|
Sources []string
|
||||||
Generates []string
|
Generates []string
|
||||||
@ -32,7 +33,7 @@ func (c *Checksum) IsUpToDate() (bool, error) {
|
|||||||
data, _ := ioutil.ReadFile(checksumFile)
|
data, _ := ioutil.ReadFile(checksumFile)
|
||||||
oldMd5 := strings.TrimSpace(string(data))
|
oldMd5 := strings.TrimSpace(string(data))
|
||||||
|
|
||||||
sources, err := globs(c.Dir, c.Sources)
|
sources, err := globs(c.TaskDir, c.Sources)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@ -43,7 +44,7 @@ func (c *Checksum) IsUpToDate() (bool, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !c.Dry {
|
if !c.Dry {
|
||||||
_ = os.MkdirAll(filepath.Join(c.Dir, ".task", "checksum"), 0755)
|
_ = os.MkdirAll(filepath.Join(c.BaseDir, ".task", "checksum"), 0755)
|
||||||
if err = ioutil.WriteFile(checksumFile, []byte(newMd5+"\n"), 0644); err != nil {
|
if err = ioutil.WriteFile(checksumFile, []byte(newMd5+"\n"), 0644); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@ -52,7 +53,7 @@ func (c *Checksum) IsUpToDate() (bool, error) {
|
|||||||
if len(c.Generates) > 0 {
|
if len(c.Generates) > 0 {
|
||||||
// For each specified 'generates' field, check whether the files actually exist
|
// For each specified 'generates' field, check whether the files actually exist
|
||||||
for _, g := range c.Generates {
|
for _, g := range c.Generates {
|
||||||
generates, err := glob(c.Dir, g)
|
generates, err := glob(c.TaskDir, g)
|
||||||
if os.IsNotExist(err) {
|
if os.IsNotExist(err) {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
@ -107,7 +108,7 @@ func (*Checksum) Kind() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Checksum) checksumFilePath() string {
|
func (c *Checksum) checksumFilePath() string {
|
||||||
return filepath.Join(c.Dir, ".task", "checksum", c.normalizeFilename(c.Task))
|
return filepath.Join(c.BaseDir, ".task", "checksum", c.normalizeFilename(c.Task))
|
||||||
}
|
}
|
||||||
|
|
||||||
var checksumFilenameRegexp = regexp.MustCompile("[^A-z0-9]")
|
var checksumFilenameRegexp = regexp.MustCompile("[^A-z0-9]")
|
||||||
|
@ -76,7 +76,8 @@ func (e *Executor) timestampChecker(t *taskfile.Task) status.Checker {
|
|||||||
|
|
||||||
func (e *Executor) checksumChecker(t *taskfile.Task) status.Checker {
|
func (e *Executor) checksumChecker(t *taskfile.Task) status.Checker {
|
||||||
return &status.Checksum{
|
return &status.Checksum{
|
||||||
Dir: t.Dir,
|
BaseDir: e.Dir,
|
||||||
|
TaskDir: t.Dir,
|
||||||
Task: t.Name(),
|
Task: t.Name(),
|
||||||
Sources: t.Sources,
|
Sources: t.Sources,
|
||||||
Generates: t.Generates,
|
Generates: t.Generates,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user