pd93
pd93
TTask
Created by MartinsAccount on 10/19/2024 in #help
Is this the best way to create a list (that can be empty) for use with templates?
You could use compact instead of initial. This would remove any empty items from your array. Alternatively, you can build a JSON string and call fromJson. There are probably other ways too. Regarding ref. By design, it only accepts a single ActionNode (i.e. One set of {{...}}) so if statements are not possible. ref is designed for you to be able to refer to other variables while maintaining their type, not for logic. It is actually a side-effect of the templating engine that functions are available for use in ref, but we felt this was acceptable/useful.
3 replies
TTask
Created by brunoqc on 6/7/2024 in #help
sources with wildcards, can I run the command only for the modified files?
This isn't possible at the moment, but I think this could be really useful if you wanted to open an issue on GitHub
3 replies
TTask
Created by nck on 6/3/2024 in #help
Working out why a task with sources and generates is considered up to date
The generated hash is stored in the .task directory. However, there is no way to see which files this hash represents. The behaviour that you're describing shouldn't be happening though. I created a full example similar to yours that seems to work fine
version: '3'

vars:
TARGET_DIR: ./asdf

tasks:
default:
deps: [update_target]
sources:
- "{{ .TARGET_DIR }}/**"
generates:
- foo.zip
cmds:
- zip -r foo.zip {{ .TARGET_DIR }}

update_target:
cmds:
- echo $(date) > {{ .TARGET_DIR }}/source.txt
version: '3'

vars:
TARGET_DIR: ./asdf

tasks:
default:
deps: [update_target]
sources:
- "{{ .TARGET_DIR }}/**"
generates:
- foo.zip
cmds:
- zip -r foo.zip {{ .TARGET_DIR }}

update_target:
cmds:
- echo $(date) > {{ .TARGET_DIR }}/source.txt
3 replies