Make dynamic variables run on the right directory

It was always running in the main Taskfile dir, even when the variable was
declared in an included taskfile in another directory or when task had a
custom dir.

Closes #384
This commit is contained in:
Andrey Nering
2021-01-07 11:17:38 -03:00
parent cbdd088188
commit 59d2733b88
10 changed files with 64 additions and 14 deletions

1
testdata/dir/dynamic_var/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
subdirectory/dir.txt

11
testdata/dir/dynamic_var/Taskfile.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
version: '3'
tasks:
default:
cmds:
- echo '{{.FOLDER}}' > dir.txt
dir: subdirectory
vars:
FOLDER:
sh: basename $(pwd)
silent: true

View File

@@ -0,0 +1 @@
subdirectory

View File

@@ -4,7 +4,7 @@ vars:
BUILD_DIR: $pwd
tasks:
abs.txt:
sub/abs.txt:
desc: generates dest file based on absolute paths
deps:
- sub/src.txt