1
0
mirror of https://github.com/go-task/task.git synced 2024-12-12 10:45:49 +02:00
Commit Graph

232 Commits

Author SHA1 Message Date
Andrey Nering
4e1f2ad017 Enforce NO_COLOR=1 on tests to make sure it passes
Closes #459
Fixes #480
Ref #343
Ref fatih/color#137
2021-05-30 22:48:48 -03:00
mrngsht
58c69e36a1 Evaluate sources also if status is up-to-date 2021-04-21 21:56:25 +09:00
George Pollard
fe917affd2 Include task name in log output 2021-04-04 16:16:22 -03:00
Ross Hammermeister
c6ecf70377 Adding a --concurrency (-C) flag 2021-03-07 09:49:57 -03:00
Andrey Nering
e086b654aa Environment from .env file should be available as variables
Fixes #379
2021-01-12 11:11:40 -03:00
Andrey Nering
4afc0e8ed0 Fixed some bugs and regressions regarding dynamic variables and directories
Closes #426
2021-01-09 13:51:06 -03:00
Andrey Nering
83d25bfa00 Refactor: Fix import order
It should be: stdlib > libs > app
2021-01-07 11:48:33 -03:00
Andrey Nering
59d2733b88 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
2021-01-07 11:26:11 -03:00
Andrey Nering
ac8e344173 Run "set -e" automatically for every command
Without this, multiline command strings won't always exit when they fail.

Closes #403
2020-12-27 17:15:12 -03:00
Kevin Ard
347c796662 add tests to previous 2020-11-13 16:24:34 -05:00
Andrey Nering
582a66bb2f
Merge pull request #385 from chris-garrett/dev/378-missing-env
Resolves #378 - allow for missing env files as they may be bootstrapped.
2020-10-12 21:12:08 -03:00
Andrey Nering
d78f78bb5c Fix panic for empty tasks
Closes #338
Closes #362

Co-authored-by: Bharath Kumar <shettybharath4@gmail.com>
2020-10-12 21:03:13 -03:00
Chris Garrett
c6138a0660 #378 - allow for missing env files as they may be bootstrapped. 2020-10-03 16:39:58 -06:00
Damian Szulc
47dd9b5a03 Move args and taskfile packages to root directory 2020-08-19 10:59:58 +02:00
Andrey Nering
fb72b46a3c github.com/go-task/task/v2 -> github.com/go-task/task/v3 2020-08-16 15:48:19 -03:00
Chris Garrett
8b962fb8e8 #324 implement dotenv 2020-08-03 16:18:38 -06:00
Adam Wasila
4bc183a8a1 Add basic unit tests for label attribute 2020-06-14 15:12:48 +02:00
Andrey Nering
9f0f18c5c4 v3: Allow interpolation on "includes"
The idea is to allow manual inclusion of a OS-dependant Taskfile, since it's
not automatically included anymore.
2020-05-17 16:03:03 -03:00
Andrey Nering
68ce8642b1 Create v3 compiler which respects declaration order of variables
Also, fix "<no value>" been printed when a non-existing variable is printed.
2020-05-16 15:46:07 -03:00
Evgeny Abramovich
17ad7060b3 Added version validation and updated tests 2020-02-15 17:24:06 +03:00
Evgeny Abramovich
f38ba7fcd3 Removed automatic inclusion of Taskfiles by OS and update tests 2020-02-15 17:19:09 +03:00
Evgeny Abramovich
d567e23e50 Added tests for new inport taskfile logic 2020-01-29 11:25:11 +03:00
Andrey Nering
b7b752b92f Allow shorter syntax for tasks with default configuration
Closes #194
Closes #240

Co-authored-by: Jaedle <dennis.jekubczyk@gmail.com>
2019-12-07 21:28:02 -03:00
Andrey Nering
7373639f57 Expose .TASK variable with the task name
Closes #252
2019-12-07 19:43:10 -03:00
Andrey Nering
14d7f04a81 Always expode .TIMESTAMP and .STATUS when using status: 2019-09-14 18:04:41 -03:00
Andrey Nering
1a28e5e0d4 Few code improvements on #216 2019-09-14 17:54:41 -03:00
Andrey Nering
884cd0d636 Merge branch 'CypherpunkArmory-report-timestamp-to-status' into v3 2019-09-14 17:18:42 -03:00
Andrey Nering
78595fba0b Make "checksum" the default method in v3 2019-09-08 22:51:56 -03:00
Andrey Nering
d6a49da870 Merge branch 'master' into v3 2019-09-08 22:12:02 -03:00
Andrey Nering
84da80356d Use stdlib instead of go-homedir 2019-09-08 22:07:48 -03:00
Andrey Nering
0e1d8a72e6 Revert "Ensure the $HOME env is being set on Windows"
This reverts commit 52028fc3bc.
2019-09-08 21:56:23 -03:00
Andrey Nering
7138785500 Merge branch 'master' into v3 2019-09-07 14:44:21 -03:00
Andrey Nering
52028fc3bc Ensure the $HOME env is being set on Windows 2019-09-07 14:29:13 -03:00
Andrey Nering
5285ec23ae Fix summary test on Windows 2019-09-01 22:26:53 -03:00
Andrey Nering
1a33f9168b Merge branch 'report-timestamp-to-status' of https://github.com/CypherpunkArmory/task into CypherpunkArmory-report-timestamp-to-status 2019-09-01 21:44:23 -03:00
Stephen Prater
a1aec8178a Export Time Struct to Template 2019-08-25 13:36:48 -07:00
Stephen Prater
cb6fe4bb59 Merge remote-tracking branch 'upstream/v3' into report-timestamp-to-status
* upstream/v3:
  v3.0.0-preview1
  Update v3 changelog
  Only have colored output on v3
  Add --color=false flag to disable colored output
  Update documentation about sprig
  Update CHANGELOG
  Migrate from sprig to slim-sprig
  Fix build after merging master
  Use colors for some output messages
2019-08-25 10:33:13 -07:00
Stephen Prater
1ee684b7c0 Expose timestamp and checksum to status 2019-08-25 09:39:39 -07:00
jaedle
af5d9c952d assert error message 2019-08-19 21:01:01 +02:00
jaedle
0f385f9f4e remove v1 2019-08-18 17:37:21 +02:00
Andrey Nering
7f082a821d Merge branch 'v3' into colored-output 2019-06-15 22:42:15 -03:00
Andrey Nering
4cee4aa5a8 Fix typo 2019-06-15 21:58:37 -03:00
Andrey Nering
0608782cfa
Merge pull request #205 from CypherpunkArmory/add-precondition-to-task
Add Preconditions to Tasks
2019-06-15 21:55:20 -03:00
Stephen Prater
cc9264854e Change error output 2019-06-11 12:20:56 -07:00
Stephen Prater
d1463b3e24 Fix typos per review 2019-06-11 11:46:22 -07:00
Marco Molteni
c663c5c507 When "dir:" attribute points to a non-existing dir, create it
Closes #209
2019-06-04 18:58:22 +02:00
Marco Molteni
1e93c38307 Task directory: test when "dir:" attribute points to an existing dir 2019-06-04 18:36:35 +02:00
Marco Molteni
81baf808c9 Task directory: test default case (no "dir:" attribute) 2019-06-04 18:24:01 +02:00
Marco Molteni
74537689dc Fix spelling 2019-06-04 08:08:25 +02:00
Stephen Prater
044d3a0ff9 Remove ignore_errors 2019-05-28 13:02:59 -07:00
Andrey Nering
8efc38ad82 Use colors for some output messages 2019-05-26 18:36:39 -03:00
Stephen Prater
bd5882f0f0 Add Preconditions to Tasks 2019-05-17 13:51:15 -07:00
jaedle
808542bed0 remove unnecassry test for multiple summaries 2019-03-04 12:13:13 +01:00
jaedle
93bfd57856 print summary for multiple tasks 2019-03-04 12:09:58 +01:00
jaedle
3ca590b185 display summary for tasks without summary/description 2019-02-24 19:02:44 +01:00
jaedle
4dcb124693 print commands on summary only if commands are present 2019-02-24 16:08:32 +01:00
jaedle
31ecf167cc rename to summary in test fixtures 2019-02-24 15:54:11 +01:00
jaedle
d05d418c4c renaming field in taskfile to summary 2019-02-24 15:37:02 +01:00
jaedle
06d0af7a1d rename details in Executor to summary 2019-02-24 15:33:09 +01:00
jaedle
1c3082ffa6 rename test fixture 2019-02-24 14:48:48 +01:00
jaedle
db1d3183b6 refatoring 2019-02-24 14:32:47 +01:00
jaedle
fb666394fc refatoring 2019-02-24 14:31:29 +01:00
jaedle
8dd87dc482 refactoring 2019-02-24 14:23:44 +01:00
jaedle
b2edbf05a1 refactoring 2019-02-24 14:20:39 +01:00
jaedle
6fb53a406b remove unusued expectations 2019-02-24 14:18:51 +01:00
jaedle
b05fa0821d move expectations for output to testdata 2019-02-24 14:18:07 +01:00
jaedle
0a808b1212 fix swapped expected and actual parameter 2019-02-24 14:10:46 +01:00
jaedle
f1d83e92a7 print command stub on details 2019-02-24 14:08:27 +01:00
jaedle
31b60f7f60 display task name on details 2019-02-24 14:01:53 +01:00
jaedle
c0f9af5daa refactoring 2019-02-24 12:15:59 +01:00
jaedle
b25a9e8884 refactoring 2019-02-24 12:13:18 +01:00
jaedle
1ac6f17e6a should not surpress empty lines expect on last line 2019-02-24 11:58:44 +01:00
jaedle
b97221cdb2 ignore empty lines on description 2019-02-24 11:31:25 +01:00
jaedle
0164bc21ea be more specific in tests about output 2019-02-24 11:28:15 +01:00
jaedle
5a23250d32 simplified tests 2019-02-24 11:25:26 +01:00
jaedle
80d88d9789 refactoring 2019-02-24 11:22:14 +01:00
jaedle
31ead854c7 fix test expectation 2019-02-24 11:19:08 +01:00
jaedle
4b64fcb8a4 add more tests 2019-02-24 11:09:55 +01:00
jaedle
a951f2403d add more tests for details 2019-02-24 11:01:48 +01:00
jaedle
f9adeba7f1 add basic test for details 2019-02-24 09:53:49 +01:00
Andrey Nering
f8a6c5d06c Fix execext.Expand for file names with spaces
Fixes #176
2019-02-21 20:59:17 -03:00
Andrey Nering
902f0d3ac4 Don't persist new checksum on the disk if dry mode is enabled
Fixes #166
2019-02-09 10:44:35 -02:00
Andrey Nering
713ecd35f6 Pass context as an argument 2019-02-09 10:16:13 -02:00
Andrey Nering
1dec956e99 Allow calling a task of the root Taskfile from within an included Taskfile
Fixes #161
2019-02-02 21:22:08 -02:00
Andrey Nering
aac6c5a1c7 Add hability to globally set environment variables
Closes #138
2019-01-02 12:06:12 -02:00
Andrey Nering
95b75c5330 Fix issue on running dependencies or tasks on included Taskfiles
Fixes #151
2018-12-09 15:54:58 -02:00
Andrey Nering
a9b1f38a7c Fix nil errors when merging Taskfiles
Closes #150
2018-12-02 14:17:32 -02:00
Andrey Nering
3cbc89769d Re-write import paths to v2 2018-11-04 21:23:35 -02:00
Andrey Nering
5eb1a1f7f5 Fixes to Taskfile including:
- Disallow recursive Taskfile including (i.e. included Taskfile including other Taskfiles)
- Write test for included a file instead of a directory
2018-10-13 17:52:09 -03:00
Andrey Nering
5a28560177 Write first test for including a Taskfile 2018-10-13 16:56:51 -03:00
Andrey Nering
76253bf516 Reduce code duplication on test 2018-08-05 12:56:55 -03:00
Andrey Nering
feaf70922d Allow ignore_error at task level 2018-08-05 12:53:42 -03:00
Andrey Nering
550c116aea
Merge branch 'master' into master 2018-08-05 11:32:07 -03:00
Andrey Nering
a5f31a4280 Dry run small code style changes 2018-08-05 11:28:02 -03:00
Tobias Salzmann
90a5f17f58
Merge branch 'master' into master 2018-08-01 10:47:25 +02:00
Tobias Salzmann
108cb91d95 IgnoreError
* Document ignore_error
* ignore_error only for commands
2018-08-01 10:44:53 +02:00
Josh Bebbington
00a0755ff3 Added test for executor.DryRun 2018-07-31 23:17:21 +01:00
Andrey Nering
67105b332f Move path expanding logic to shell.Expand 2018-07-15 15:49:00 -03:00
Tobias Salzmann
05600601ff add ignoreError option 2018-07-10 10:44:58 +02:00
Andrey Nering
120d0be84c Fixes panic on task --list
Fixes #99
2018-03-11 14:39:40 -03:00
Andrey Nering
1a3df08aca Allow global variables in the Taskfile
Closes #66
2018-03-04 15:39:14 -03:00
Andrey Nering
2d4ca37226 Use semver for Taskfile versions 2018-03-03 18:54:42 -03:00
Andrey Nering
3556942516 Improve nested variables support
Closes #76 #89 #77 #83
2018-02-18 09:50:39 -03:00
Andrey Nering
87a200e42c Extract some functionality to its own packages
Like variable and template handling, and logging
2018-02-17 16:12:41 -02:00
Andrey Nering
152fc0ad38 Move all structs related to Taskfile to its own package 2018-02-17 14:22:18 -02:00
Andrey Nering
134c6b79c4 Add Taskfile struct and start implementing new format
Updates #54, #66 and #77
2017-12-29 18:46:15 -02:00
Andrey Nering
dfd890c8a6 Revert "simplify getVariables() and improve nested variables support"
This reverts commit 9619c7f54d.
2017-11-19 18:46:46 -02:00
Andrey Nering
9619c7f54d simplify getVariables() and improve nested variables support
/cc @smyrman
2017-11-17 00:54:26 -02:00
Andrey Nering
44a52359dc checksum: save them in a subdir .task/checksum
future-proof since the .task directory can be used to save other state
in the future
2017-11-02 10:37:02 -02:00
Andrey Nering
48bf09da21 remove deprecated set keyword 2017-09-17 11:24:30 -03:00
Andrey Nering
c295a1998a add checksum based status check, alternative to timestamp based 2017-09-17 11:06:47 -03:00
Andrey Nering
f3097845b4 allow assigning variables to tasks at run time via CLI
using a similar syntax than setting env variables to command in bash,
but used right after the task:

```bash
task print MESSAGE=Hello!
```

closes #33
2017-09-07 13:57:06 -03:00
Sindre Røkenes Myren
7a64530e83 Added suport for multiline variables from sh
Instead of giving an error on multiline results from sh, the results are
now stored as is, except that the last newline is stripped away to make
the output of most commands easy to use in shell commands.

Two helper functions have been added to help deal with multi-line
results. In addition, previous PascalCase template function names have
been renamed to camelCase for consistency with the sprig lib.
2017-09-04 10:14:09 +02:00
Sindre Røkenes Myren
72bfd94329 Fixes env: remove square braces and evaluate shell (#62)
Fixes bug #61, and makes `env` work more similar to `vars` by allowing
dynamic shell values to be evaluated as part of `CompiledTask`.
2017-08-16 08:04:58 -03:00
Andrey Nering
bb1aff84cf custom stdout for InitTaskfile func 2017-07-30 19:29:49 -03:00
Sindre Røkenes Myren
31faf05c3a Reintroduce template evaluation in variables
With a recent commit, template evaluation for variables in tasks got
broken. This reindroudces temmplate evaluation in taks, and resolves
a series of issues that where previouisly present on master, such as:

- Taskvars did not get evaluated as templates.
- Taskvars would, in contrast to the documentation, _override_ task
  variables for the taks called directly via `Executor.Run(args
  ...string)`. This caused different behaviour in the "default" task
  v.s. other tasks.

This commit ensures:
 - Priority order for variables is now according to the documentation,
   also for the "default" task.
 - Variables gets resolved in a particular order to ensure logical
   access to varaibles on template compile time, and that template
   compilation finds place _before_ resolution of dynamic variables.

This change also allows the following to work:

    task:
      vars:
        A: "52"
        B: "{{.A}}"

However, the following will always replace C with the uncompiled
`{{.A}}`:

    task:
      vars:
        A: "52"
        C: "{{.B}}"
        B: "{{.A}}"

Several tests have also been added to prevent this feature from breaking
again. This should hopefully finally resolve issue #40.
2017-07-22 00:50:23 +02:00
Andrey Nering
e8e914b11c use YAML for dynamix variable instead of $ prefix
$ prefix still works but is now deprecated

before:

    VAR: $echo var

after:

    VAR:
      sh: echo bar

closes #46
2017-07-15 15:28:59 -03:00
Andrey Nering
5ece1d74f6 fix Taskvars.yml vars not available while interpolating vars prop
closes #40
2017-07-15 14:40:58 -03:00
Sindre Røkenes Myren
86a23849e0 Allow absolute path in generates section
Fixes issue #47 by allowing absolute paths in a task's generates and
sources sections. Tests are added for the generates section only at this
time.
2017-07-12 18:14:34 +02:00
Sindre Myren
a548c63a92 Bugfix: allow templating when calling deps
Fixes issue #42 by allowing for template evaluatation on task override
variables when the task is launched as dependency.
2017-07-09 23:48:36 +02:00
Andrey Nering
2dd3564da1 changed cyclic dep detection
since interpolation can be used, detection should be a execution time,
and not before

now, to prevent infinite execution, there's a miximum of 100 calls per
task

closes #37
2017-07-08 13:33:55 -03:00
Sindre Røkenes Myren
2f9381065d Allow template evaluation in parameters
When passing variables to a sub-task, allow template evaluation
within the passed-on variables.
2017-07-07 00:47:56 +02:00
Andrey Nering
196d3cb13d add custom Cmd and Dep types 2017-07-03 21:04:38 -03:00
Andrey Nering
ecfd8e8a62 change all tests to call functions instead of binary directly
I had to temporarely hack github.com/mvdan/sh to fix dir handling
2017-07-01 15:32:13 -03:00
Andrey Nering
81e0f170ef accept setting dir of execution and improve tests
One test is not yet migrated. First we should have specific
Stdin, Stdout and Stderr for executor.
2017-06-24 20:09:05 -03:00
Andrey Nering
2615000609 Add --init flag to create a new Taskfile 2017-05-17 15:38:46 -03:00
Andrey Nering
2a2dfce137 Add status option to prevent task from running
Closes #27
2017-05-17 14:37:16 -03:00
Andrey Nering
59306cda38 Possibility to call another task 2017-03-25 15:26:42 -03:00
Andrey Nering
0db3e9a05d Fix "=" not being reconized in variables/environment variables
Fixes #19
2017-03-25 11:01:44 -03:00
Andrey Nering
c2773a7287 Fix delete of files before test run 2017-03-25 10:52:41 -03:00
Andrey Nering
e28b0bc646 Write tests for variables 2017-03-25 10:51:30 -03:00
Andrey Nering
06633e2f99 Write first test for deps 2017-03-15 21:15:27 -03:00