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

1921 Commits

Author SHA1 Message Date
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
Andrey Nering
36f3be9979 travis: test Go 1.8 and 1.9 2017-09-02 11:42:33 -03:00
Andrey Nering
451b965fb0 execext: use sync.Pool to instantiate parser and runner
A benchmark was added. The performance improvement is considerable:

BenchmarkNoPool-4   	   30000	     43405 ns/op
BenchmarkPool-4     	   20000	     71219 ns/op
2017-09-02 11:32:24 -03:00
Andrey Nering
2b2852aad7 update deps and moving from github.com/mvdan/sh to mvdan.cc/sh 2017-09-02 11:19:00 -03: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
300376b0b1 update README 2017-08-05 14:52:32 -03:00
Andrey Nering
e67792177d execext: fix sh 2017-08-05 14:20:44 -03:00
Andrey Nering
0f24fd593e update dependencies
- add watch
- remove fsnotify
- update others
2017-08-05 14:13:35 -03:00
Andrey Nering
23ec6c721d Merge branch 'watch' 2017-08-05 14:06:46 -03:00
Andrey Nering
26761e5445 watch: isContextError is as a var func 2017-08-05 14:04:34 -03:00
Andrey Nering
e78e4e6a2e watch: ignore usually big dirs
Two items by now:
- ".git"
- "node_modules"
2017-08-05 13:35:10 -03:00
Andrey Nering
e765b7a9c4 do not check for maximum call if is watch 2017-08-05 13:26:30 -03:00
Andrey Nering
c210e34ce3 watch: switch to watcher as waych lib and few fixes
watcher whould be more consistent across differente OSes
2017-08-05 11:50:39 -03:00
Jack Mordaunt
ddd063f29e Cancel and restart long running process on file change by using context.WithCancel(..)
Closes #59
2017-08-04 12:48:15 -03:00
Andrey Nering
a2c96e9cdd re-generate vendor/ folder
maybe a bug on dep? these two files were not copied
2017-07-30 21:09:05 -03:00
Andrey Nering
f2416d68b8 fix travis again
something was wrong with .gitignore rules
2017-07-30 21:00:50 -03:00
Andrey Nering
1eccb61d44 fix travis
somehow the dev.go file was ignored by Git
2017-07-30 20:53:54 -03:00
Andrey Nering
cf2b189fbd v1.4.2 2017-07-30 20:42:15 -03:00
Andrey Nering
394b69676a rename func to handleShVar 2017-07-30 20:36:35 -03:00
Andrey Nering
9704dc5734 reuse of minTime and maxTime funcs 2017-07-30 20:00:35 -03:00
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
bb1aff84cf custom stdout for InitTaskfile func 2017-07-30 19:29:49 -03:00
Andrey Nering
dc1ec77da5 own Taskfile: non-verbose test 2017-07-30 19:26:18 -03:00
Andrey Nering
7077b20a54 flag to set directory of execution 2017-07-30 19:24:53 -03:00
Andrey Nering
09e84c2583 always echo command if is verbose mode 2017-07-30 19:21:06 -03:00
Andrey Nering
e3ac6f9e01 fix sh field name 2017-07-30 19:12:26 -03:00
Andrey Nering
f91bbe9397 update deps 2017-07-30 19:11:34 -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
55672410cd own Taskfile: small improvement of lint task 2017-07-19 20:24:40 -03:00
Andrey Nering
8a66857fb9 Merge branch 'silent' 2017-07-19 20:20:49 -03: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
726130be09 v1.4.1 2017-07-15 15:52:33 -03:00
Andrey Nering
968a29d869 deduplicate conversion from dep and cmd to call 2017-07-15 15:46:53 -03:00
Andrey Nering
ce27e973be hotpath for a blank variable template 2017-07-15 15:38:57 -03:00
Andrey Nering
2607866c49 readme: document new syntax for synamic variables 2017-07-15 15:37:24 -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
d22b3b0d88 readme: document the task_checksum.txt file on releases
closes #44
2017-07-15 14:52:31 -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
ac7ab42d94 Create CODE_OF_CONDUCT.md 2017-07-15 14:31:53 -03:00
Andrey Nering
38a3f538f5 add CONTRIBUTING.md 2017-07-15 14:27:45 -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
Andrey Nering
e781ac2512 own Taskfile: add task "todo" to print TODOs in code 2017-07-15 13:58:03 -03:00
Andrey Nering
ef2695974d os specific Taskvars file
Now it's possible to have Taskfile_windows.yml or Taskvars_linux.yml
(and others).

Asked in a comment in #46
2017-07-15 13:52:02 -03:00
Andrey Nering
b552cc2b12 yaml: use UnmarshalStrict instead on Unmarshal
https://github.com/go-yaml/yaml/pull/262
2017-07-15 13:36:22 -03:00
Andrey Nering
4ae9c2445d update deps 2017-07-15 13:34:42 -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 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