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

141 Commits

Author SHA1 Message Date
Andrey Nering
f54dde4f78 func isUpToDate should be bound to Task struct 2017-07-30 19:45:59 -03:00
Andrey Nering
70ef9fbcfe rename func: ReplaceVariables -> CompiledTask 2017-07-30 19:34:28 -03:00
Andrey Nering
09e84c2583 always echo command if is verbose mode 2017-07-30 19:21:06 -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
d0b37df615 add silent mode to disable echoing of commands 2017-07-19 20:20:24 -03:00
Andrey Nering
dc6cb68327 rename file.go to status.go, and move related code there 2017-07-16 16:15:29 -03:00
Andrey Nering
72250b32d3 replace variables in a task once, instead of mixing these calls with unrelated code
this is the first big step of #45

now t.ReplaceVariable will return a copy of the task, but with variables
replaced

now we don't need to replace variables everywhere in the code, and will
make other refactorings easier
2017-07-16 16:09:55 -03:00
Andrey Nering
968a29d869 deduplicate conversion from dep and cmd to call 2017-07-15 15:46:53 -03: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
Andrey Nering
998935ea55 add --list (or -l) flag to print existing tasks
If an inexixtent task is given, the help also prints as before

Also fixing README documentation

Closes #51
2017-07-15 14:10:46 -03:00
Sindre Røkenes Myren
769e25f080 Consider task up-to-date on equal timestamps
Fixes issue #48 by considering a task up-to-date if the newest
file from sources and the oldest file from generates has
exactly the same time-stamp.
2017-07-12 18:18:26 +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
5268df6bfd only get variable map twice and implement vars template
ref #40
2017-07-08 16:00:17 -03:00
Andrey Nering
0da130ee2c refactor: simplify some controls 2017-07-08 15:08:44 -03:00
Andrey Nering
6e880c9027 refactor: don't need to run template on Executor.Dir 2017-07-08 15:01:45 -03:00
Andrey Nering
ff1c49f111 refactor: better usage of bytes.Buffer type 2017-07-08 14:57:12 -03:00
Andrey Nering
7a7f66dfdc refactor: join task and vars parameters in a single Call struct 2017-07-08 14:34:17 -03: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
Andrey Nering
06031efc09 cyclic: refactor to return error instead 2017-07-08 10:13:56 -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
ad1a440576 cache dymanic variables 2017-07-05 21:03:59 -03:00
Andrey Nering
222b5cb587 add verbose mode (-v flag) 2017-07-05 20:56:31 -03:00
Andrey Nering
06d80e92eb rename Cmd.Params to Cmd.Vars 2017-07-05 20:07:27 -03:00
Andrey Nering
b8fe8d465e refactor: onyl read Taskvars file once 2017-07-03 21:16:10 -03:00
Andrey Nering
196d3cb13d add custom Cmd and Dep types 2017-07-03 21:04:38 -03:00
Sindre Røkenes Myren
2ace0defd0 Print command, also when "set:" is specified
Always prints the command, even when the
set-keyword is used within the task.
2017-07-03 15:05:19 +02:00
Andrey Nering
9ba44f3e6e allow custom Stdin, Stdout and Stderr while running as a lib 2017-07-01 15:05:51 -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
540e458b16 refactor isUpToDate() 2017-06-04 16:45:34 -03:00
Andrey Nering
b530cba0d5 Abstract Tasks type 2017-06-04 16:41:38 -03:00
Andrey Nering
f98bf6c4b1 refactor: Create executor struct to get rid of global variables
Maybe eventually help on #17
2017-06-04 16:02:04 -03:00
Andrey Nering
2615000609 Add --init flag to create a new Taskfile 2017-05-17 15:38:46 -03:00
Andrey Nering
83f1b213fa Use context on status commands 2017-05-17 14:53:39 -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
b269c6e162 Allow interpolation on "generates" and "sources" attributes
Closes #26
2017-04-30 19:32:33 -03:00
Andrey Nering
8b76911675 Small refactor of variables replacing 2017-04-30 19:13:21 -03:00
Andrey Nering
6bc27baa96 Migrate from os/exec.Cmd to a native Go sh interpreter
github.com/mvdan/sh

Closes #23
2017-04-24 09:45:57 -03:00
Andrey Nering
c591ea4185 Use context together with errgroup
This will let other deps to be killed when one of the deps returns an
error.

Before this change, the process could keep running even after Task
exited.
2017-04-12 20:53:41 -03:00
Andrey Nering
109f20f193 Using golang.org/x/sync/errgroup to exec deps 2017-04-12 20:39:52 -03:00
Andrey Nering
822f7f83ee execext package: support context command 2017-04-12 20:32:56 -03:00
Andrey Nering
72a6727e31 Watch task 2017-04-01 16:11:32 -03:00
Andrey Nering
36614dccf8 More sophisticated cyclic dependency detection 2017-03-25 16:06:49 -03:00
Andrey Nering
59306cda38 Possibility to call another task 2017-03-25 15:26:42 -03:00
Andrey Nering
2054a1bc34 Minor improvements for tasks description 2017-03-19 15:18:18 -03:00
Rene Zbinden
e4c1cc3e77 add help task
Signed-off-by: Andrey Nering <andrey.nering@gmail.com>
2017-03-19 15:00:25 -03:00
Andrey Nering
ce823ad510 Run deps concurrently 2017-03-15 20:19:29 -03:00
Andrey Nering
94c33668bd Print command right before run 2017-03-12 18:02:33 -03:00
Andrey Nering
8c5e7e89cd Little refactor on command creation 2017-03-12 17:18:59 -03:00
Sascha Andres
12babf4204 Support for a default branch 2017-03-09 17:18:46 +01:00
Andrey Nering
0cc7fae704 Using receiver instead of passing t.Env as parameters 2017-03-08 18:39:47 -03:00
Sascha Andres
ef75d5061d Merge branch 'master'
Conflicts:
	README.md
	task.go
2017-03-07 12:35:45 +01:00
Sascha Andres
5b3c11eabd Merge pull request #9 from go-task/feature/env
Allow specifying additional environment settings
2017-03-07 12:31:46 +01:00
Sascha Andres
6636cd38c0 Implemented os specific task file support 2017-03-07 09:45:14 +01:00
Rene Zbinden
f9454a3808 fix trailing white space for set instruction 2017-03-07 08:01:20 +01:00
Sascha Andres
72528af18a Applying variables to env section 2017-03-06 13:52:46 +01:00
Sascha Andres
6f7b26908f Added ability to add environment variables per task
Add an anv section to the task
2017-03-06 13:49:17 +01:00
Andrey Nering
91d5fa5fe6 Switch variable replacing with Go's template engine 2017-03-05 16:49:44 -03:00
Andrey Nering
7db3db48b0 Minimal refactoring od isTaskUpToDate() 2017-03-05 15:59:30 -03:00
Andrey Nering
fa850d1440 Rename "variables" key to "vars" for brevity 2017-03-05 15:56:22 -03:00
Andrey Nering
3aaf1b2ec1 Refactoring and redirect Stdout and Stdin of not set var 2017-03-05 15:52:58 -03:00
Sascha Andres
561c213a92 Running deps first 2017-03-05 10:15:49 +01:00
Sascha Andres
e6bb0cfc6d Changed to be quiet when a variable is set 2017-03-05 10:07:08 +01:00
Sascha Andres
a9181255b8 Merge branch 'master' into master 2017-03-03 09:01:59 +01:00
Andrey Nering
576b18246a Prefix all output messages from task with "task: "
This makes it easier to know if a message comes from task or from a command
stdout or stderr
2017-03-02 20:56:40 -03:00
Andrey Nering
a9b8e31228 Move error types to its own file 2017-03-02 20:52:03 -03:00
Andrey Nering
b8116015c7 Minor improvements for #5 2017-03-02 20:45:52 -03:00
Andrey Nering
f7d119f544 Merge pull request #5 from sascha-andres/master
Simple cyclic dependency detection
2017-03-02 20:39:20 -03:00
Sascha Andres
9abe71e967 Moved handleVariables() into command loop 2017-03-02 20:34:09 +01:00
Sascha Andres
eb783d04b8 Allow setting a variable 2017-03-02 20:19:25 +01:00
Andrey Nering
c655f23755 Running deps before verifying if the current task is up-to-date 2017-03-02 08:56:13 -03:00
Sascha Andres
b9820c5c7d Handling errors on variable handling
Relates to #2
2017-03-02 11:30:59 +01:00
Sascha Andres
240589978d Variable handling
Relates to #2
2017-03-02 10:46:20 +01:00
Sascha Andres
ea2e86e398 Simple cyclic dependency detection 2017-03-02 09:38:23 +01:00
Andrey Nering
f899df2e82 Use github.com/spf13/pflag instead of stdlib flag 2017-03-01 20:43:27 -03:00
Andrey Nering
131499b66d Add -f flag to force execution even when task is up-to-date 2017-03-01 20:21:36 -03:00
Sascha Andres
1576943702 Changed minor code style 2017-03-01 14:33:10 +01:00
Sascha Andres
a493591541 Added support for chdir option in task 2017-03-01 13:35:00 +01:00
Travis
61b1aa8559 added yml/json/toml support, --help flag, and example directory
Signed-off-by: Andrey Nering <andrey.nering@gmail.com>
2017-02-28 18:33:53 -03:00
Andrey Nering
a15cf26842 Make golint happy 2017-02-28 09:50:40 -03:00
Andrey Nering
b8b52b94f9 Change patterns to slice to support multiple 2017-02-27 17:03:25 -03:00
Andrey Nering
0e1aaabf11 DO nor re-run up-to-date tasks, based on ModTime and given patterns 2017-02-27 16:44:08 -03:00
Andrey Nering
7cab3997c1 Use relative path 2017-02-27 10:57:09 -03:00
Andrey Nering
5b1d106724 Support run multiple commands 2017-02-27 10:13:06 -03:00
Andrey Nering
49d4901c76 Support Windows
If "sh" is available (Git bash) it is used. Otherwise "cmd" is used.
2017-02-27 10:07:54 -03:00
Andrey Nering
a441fea849 Move main package to cmd/task 2017-02-27 09:48:50 -03:00
Andrey Nering
6104b42368 Better error message on task run error 2017-02-26 21:23:38 -03:00
Andrey Nering
b2621a8bc3 Support task dependencies 2017-02-26 21:18:53 -03:00
Andrey Nering
53f8766b80 Redirect stderr 2017-02-26 20:53:57 -03:00
Andrey Nering
389d7f7aed First working version 2017-02-26 20:43:50 -03:00
Andrey Nering
39e60d6278 Initial commit 2017-02-26 20:14:36 -03:00