Skip to content

Commit

Permalink
Merge pull request #5 from tonobo/upstream-changes
Browse files Browse the repository at this point in the history
Upstream changes
  • Loading branch information
tonobo authored Feb 23, 2019
2 parents ce13b8a + 41402dd commit 95f6bbd
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 8 deletions.
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## Unreleased
## v2.4.0 - 2019-02-21

- Allow calling a task of the root Taskfile from an included Taskfile
by prefixing it with `:`
Expand All @@ -9,7 +9,11 @@
([#173](https://github.com/go-task/task/pull/173));
- Fix bug where Task was persisting the new checksum on the disk when the Dry
Mode is enabled
([#166](https://github.com/go-task/task/issues/166)).
([#166](https://github.com/go-task/task/issues/166));
- Fix file timestamp issue when the file name has spaces
([#176](https://github.com/go-task/task/issues/176));
- Mitigating path expanding issues on Windows
([#170](https://github.com/go-task/task/pull/170)).

## v2.3.0 - 2019-01-02

Expand Down
2 changes: 1 addition & 1 deletion docs/releasing_task.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ the [Snapcraft dashboard][snapcraftdashboard]

Scoop is a community owned installation method. Scoop owners usually take care
of updating versions there by editing
[this file](https://github.com/lukesampson/scoop-extras/blob/master/task.json).
[this file](https://github.com/lukesampson/scoop-extras/blob/master/bucket/task.json).
If you think its Task version is outdated, open an issue to let us know.

[goreleaser]: https://goreleaser.com/#continuous_integration
Expand Down
3 changes: 3 additions & 0 deletions internal/execext/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"io"
"os"
"path/filepath"
"strings"

"mvdan.cc/sh/expand"
Expand Down Expand Up @@ -72,6 +73,8 @@ func IsExitError(err error) bool {
// Expand is a helper to mvdan.cc/shell.Fields that returns the first field
// if available.
func Expand(s string) (string, error) {
s = filepath.ToSlash(s)
s = strings.Replace(s, " ", `\ `, -1)
fields, err := shell.Fields(s, nil)
if err != nil {
return "", err
Expand Down
13 changes: 8 additions & 5 deletions task_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,16 +274,19 @@ func TestStatus(t *testing.T) {
}

func TestGenerates(t *testing.T) {
var srcTask = "sub/src.txt"
var relTask = "rel.txt"
var absTask = "abs.txt"
const (
srcTask = "sub/src.txt"
relTask = "rel.txt"
absTask = "abs.txt"
fileWithSpaces = "my text file.txt"
)

// This test does not work with a relative dir.
dir, err := filepath.Abs("testdata/generates")
assert.NoError(t, err)
var srcFile = filepath.Join(dir, srcTask)

for _, task := range []string{srcTask, relTask, absTask} {
for _, task := range []string{srcTask, relTask, absTask, fileWithSpaces} {
path := filepath.Join(dir, task)
_ = os.Remove(path)
if _, err := os.Stat(path); err == nil {
Expand All @@ -299,7 +302,7 @@ func TestGenerates(t *testing.T) {
}
assert.NoError(t, e.Setup())

for _, theTask := range []string{relTask, absTask} {
for _, theTask := range []string{relTask, absTask, fileWithSpaces} {
var destFile = filepath.Join(dir, theTask)
var upToDate = fmt.Sprintf("task: Task \"%s\" is up to date\n", srcTask) +
fmt.Sprintf("task: Task \"%s\" is up to date\n", theTask)
Expand Down
10 changes: 10 additions & 0 deletions testdata/generates/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,13 @@ sub/src.txt:
- echo "hello world" > sub/src.txt
status:
- test -f sub/src.txt

'my text file.txt':
desc: generate file with spaces in the name
deps: [sub/src.txt]
cmds:
- cat sub/src.txt > 'my text file.txt'
sources:
- sub/src.txt
generates:
- 'my text file.txt'

0 comments on commit 95f6bbd

Please sign in to comment.