Skip to content

Commit 1bdf7e3

Browse files
committed
v3: Post-release improvements to the documentation
Closes #367
1 parent 7285f3c commit 1bdf7e3

File tree

1 file changed

+27
-55
lines changed

1 file changed

+27
-55
lines changed

docs/usage.md

Lines changed: 27 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -92,48 +92,8 @@ tasks:
9292
- echo "Using $KEYNAME"
9393
```
9494

95-
## Operating System specific tasks
96-
97-
If you add a `Taskfile_{{GOOS}}.yml` you can override or amend your Taskfile
98-
based on the operating system.
99-
100-
Example:
101-
102-
Taskfile.yml:
103-
104-
```yaml
105-
version: '3'
106-
107-
tasks:
108-
build:
109-
cmds:
110-
- echo "default"
111-
```
112-
113-
Taskfile_linux.yml:
114-
115-
```yaml
116-
version: '3'
117-
118-
tasks:
119-
build:
120-
cmds:
121-
- echo "linux"
122-
```
123-
124-
Will print out `linux` and not `default`.
125-
126-
Keep in mind that the version of the files should match. Also, when redefining
127-
a task the whole task is replaced, properties of the task are not merged.
128-
129-
It's also possible to have an OS specific `Taskvars.yml` file, like
130-
`Taskvars_windows.yml`, `Taskvars_linux.yml`, or `Taskvars_darwin.yml`. See the
131-
[variables section](#variables) below.
132-
13395
## Including other Taskfiles
13496

135-
> This feature is still experimental and may have bugs.
136-
13797
If you want to share tasks between different projects (Taskfiles), you can use
13898
the importing mechanism to include other Taskfiles using the `includes` keyword:
13999

@@ -150,6 +110,21 @@ namespace. So, you'd call `task docs:serve` to run the `serve` task from
150110
`documentation/Taskfile.yml` or `task docker:build` to run the `build` task
151111
from the `DockerTasks.yml` file.
152112

113+
### OS-specific Taskfiles
114+
115+
With `version: '2'`, task automatically includes any `Taskfile_{{OS}}.yml`
116+
if it exists (for example: `Taskfile_windows.yml`, `Taskfile_linux.yml` or
117+
`Taskfile_darwin.yml`). Since this behavior was a bit too implicit, it
118+
was removed on version 3, but you still can have a similar behavior by
119+
explicitly importing these files:
120+
121+
```yaml
122+
version: '3'
123+
124+
includes:
125+
build: ./Taskfile_{{OS}}.yml
126+
```
127+
153128
### Directory of included Taskfile
154129

155130
By default, included Taskfile's tasks are ran in the current directory, even
@@ -345,8 +320,8 @@ tasks:
345320
- public/style.css
346321
```
347322

348-
`sources` and `generates` can be files or file patterns. When both are given,
349-
Task will compare the checksum of the files to determine if it's
323+
`sources` and `generates` can be files or file patterns. When given,
324+
Task will compare the checksum of the source files to determine if it's
350325
necessary to run the task. If not, it will just print a message like
351326
`Task "js" is up to date`.
352327
You will probably want to ignore the `.task` folder in your `.gitignore` file
@@ -371,6 +346,10 @@ tasks:
371346

372347
> TIP: method `none` skips any validation and always run the task.
373348

349+
> NOTE: for the `checksum` (default) method to work, it's only necessary to
350+
> inform the source files, but if you want to use the `timestamp` method, you
351+
> also need to inform the generated files with `generates`.
352+
374353
### Using programmatic checks to indicate a task is up to date.
375354

376355
Alternatively, you can inform a sequence of tests as `status`. If no error
@@ -451,18 +430,19 @@ with any other tasks that depend on it.
451430

452431
```yaml
453432
version: '3'
433+
454434
tasks:
455-
task_will_fail:
435+
task-will-fail:
456436
preconditions:
457437
- sh: "exit 1"
458438
459-
task_will_also_fail:
439+
task-will-also-fail:
460440
deps:
461-
- task_will_fail
441+
- task-will-fail
462442
463-
task_will_still_fail:
443+
task-will-still-fail:
464444
cmds:
465-
- task: task_will_fail
445+
- task: task-will-fail
466446
- echo "I will not run"
467447
```
468448

@@ -520,14 +500,6 @@ tasks:
520500
- echo "{{.GREETING}}"
521501
```
522502

523-
Example of `Taskvars.yml` file:
524-
525-
```yaml
526-
PROJECT_NAME: My Project
527-
DEV_MODE: production
528-
GIT_COMMIT: {sh: git log -n 1 --format=%h}
529-
```
530-
531503
### Dynamic variables
532504

533505
The below syntax (`sh:` prop in a variable) is considered a dynamic variable.

0 commit comments

Comments
 (0)