mirror of
https://github.com/go-task/task.git
synced 2026-06-26 14:16:16 +00:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
21531b6291 | ||
|
|
bfc9d7847d | ||
|
|
3397f2855f | ||
|
|
78a69c4c3e | ||
|
|
01716f55b3 | ||
|
|
ca364c20bb |
@@ -71,7 +71,7 @@ brews:
|
|||||||
description: Task runner / simpler Make alternative written in Go
|
description: Task runner / simpler Make alternative written in Go
|
||||||
license: MIT
|
license: MIT
|
||||||
homepage: https://taskfile.dev
|
homepage: https://taskfile.dev
|
||||||
folder: Formula
|
directory: Formula
|
||||||
repository:
|
repository:
|
||||||
owner: go-task
|
owner: go-task
|
||||||
name: homebrew-tap
|
name: homebrew-tap
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v3.37.1 - 2024-05-09
|
||||||
|
|
||||||
|
- Fix bug where non-string values (numbers, bools) added to `env:` weren't been
|
||||||
|
correctly exported (#1640, #1641 by @vmaerten and @andreynering).
|
||||||
|
|
||||||
## v3.37.0 - 2024-05-08
|
## v3.37.0 - 2024-05-08
|
||||||
|
|
||||||
- Released the
|
- Released the
|
||||||
|
|||||||
16
internal/env/env.go
vendored
16
internal/env/env.go
vendored
@@ -13,19 +13,25 @@ func Get(t *ast.Task) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
environ := os.Environ()
|
environ := os.Environ()
|
||||||
|
|
||||||
for k, v := range t.Env.ToCacheMap() {
|
for k, v := range t.Env.ToCacheMap() {
|
||||||
str, isString := v.(string)
|
if !isTypeAllowed(v) {
|
||||||
if !isString {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, alreadySet := os.LookupEnv(k); alreadySet {
|
if _, alreadySet := os.LookupEnv(k); alreadySet {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
environ = append(environ, fmt.Sprintf("%s=%v", k, v))
|
||||||
environ = append(environ, fmt.Sprintf("%s=%s", k, str))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return environ
|
return environ
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func isTypeAllowed(v any) bool {
|
||||||
|
switch v.(type) {
|
||||||
|
case string, bool, int, float32, float64:
|
||||||
|
return true
|
||||||
|
default:
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@go-task/cli",
|
"name": "@go-task/cli",
|
||||||
"version": "3.37.0",
|
"version": "3.37.1",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@go-task/cli",
|
"name": "@go-task/cli",
|
||||||
"version": "3.37.0",
|
"version": "3.37.1",
|
||||||
"description": "A task runner / simpler Make alternative written in Go",
|
"description": "A task runner / simpler Make alternative written in Go",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"postinstall": "go-npm install",
|
"postinstall": "go-npm install",
|
||||||
|
|||||||
@@ -101,8 +101,9 @@ func TestEnv(t *testing.T) {
|
|||||||
Target: "default",
|
Target: "default",
|
||||||
TrimSpace: false,
|
TrimSpace: false,
|
||||||
Files: map[string]string{
|
Files: map[string]string{
|
||||||
"local.txt": "GOOS='linux' GOARCH='amd64' CGO_ENABLED='0'\n",
|
"local.txt": "GOOS='linux' GOARCH='amd64' CGO_ENABLED='0'\n",
|
||||||
"global.txt": "FOO='foo' BAR='overriden' BAZ='baz'\n",
|
"global.txt": "FOO='foo' BAR='overriden' BAZ='baz'\n",
|
||||||
|
"multiple_type.txt": "FOO='1' BAR='true' BAZ='1.1'\n",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
tt.Run(t)
|
tt.Run(t)
|
||||||
|
|||||||
9
testdata/env/Taskfile.yml
vendored
9
testdata/env/Taskfile.yml
vendored
@@ -14,6 +14,7 @@ tasks:
|
|||||||
cmds:
|
cmds:
|
||||||
- task: local
|
- task: local
|
||||||
- task: global
|
- task: global
|
||||||
|
- task: multiple_type
|
||||||
|
|
||||||
local:
|
local:
|
||||||
vars:
|
vars:
|
||||||
@@ -31,3 +32,11 @@ tasks:
|
|||||||
BAR: overriden
|
BAR: overriden
|
||||||
cmds:
|
cmds:
|
||||||
- echo "FOO='$FOO' BAR='$BAR' BAZ='$BAZ'" > global.txt
|
- echo "FOO='$FOO' BAR='$BAR' BAZ='$BAZ'" > global.txt
|
||||||
|
|
||||||
|
multiple_type:
|
||||||
|
env:
|
||||||
|
FOO: 1
|
||||||
|
BAR: true
|
||||||
|
BAZ: 1.1
|
||||||
|
cmds:
|
||||||
|
- echo "FOO='$FOO' BAR='$BAR' BAZ='$BAZ'" > multiple_type.txt
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ authors: [pd93]
|
|||||||
tags: [experiments, variables]
|
tags: [experiments, variables]
|
||||||
image: https://i.imgur.com/mErPwqL.png
|
image: https://i.imgur.com/mErPwqL.png
|
||||||
hide_table_of_contents: false
|
hide_table_of_contents: false
|
||||||
draft: true
|
|
||||||
---
|
---
|
||||||
|
|
||||||
import Tabs from '@theme/Tabs';
|
import Tabs from '@theme/Tabs';
|
||||||
@@ -15,7 +14,7 @@ import TabItem from '@theme/TabItem';
|
|||||||
Task has always had variables, but even though you were able to define them
|
Task has always had variables, but even though you were able to define them
|
||||||
using different YAML types, they would always be converted to strings by Task.
|
using different YAML types, they would always be converted to strings by Task.
|
||||||
This limited users to string manipulation and encouraged messy workarounds for
|
This limited users to string manipulation and encouraged messy workarounds for
|
||||||
simple problems. Starting from [v3.36.0][v3.36.0], this is no longer the case!
|
simple problems. Starting from [v3.37.0][v3.37.0], this is no longer the case!
|
||||||
Task now supports most variable types, including **booleans**, **integers**,
|
Task now supports most variable types, including **booleans**, **integers**,
|
||||||
**floats** and **arrays**!
|
**floats** and **arrays**!
|
||||||
|
|
||||||
@@ -175,7 +174,7 @@ We're looking for feedback on a couple of different proposals, so please give
|
|||||||
them a go and let us know what you think. :pray:
|
them a go and let us know what you think. :pray:
|
||||||
|
|
||||||
{/* prettier-ignore-start */}
|
{/* prettier-ignore-start */}
|
||||||
[v3.36.0]: https://github.com/go-task/task/releases/tag/v3.36.0
|
[v3.37.0]: https://github.com/go-task/task/releases/tag/v3.37.0
|
||||||
[slim-sprig-math]: https://go-task.github.io/slim-sprig/math.html
|
[slim-sprig-math]: https://go-task.github.io/slim-sprig/math.html
|
||||||
[slim-sprig-list]: https://go-task.github.io/slim-sprig/lists.html
|
[slim-sprig-list]: https://go-task.github.io/slim-sprig/lists.html
|
||||||
[map-variables]: /experiments/map-variables
|
[map-variables]: /experiments/map-variables
|
||||||
@@ -5,6 +5,11 @@ sidebar_position: 14
|
|||||||
|
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v3.37.1 - 2024-05-09
|
||||||
|
|
||||||
|
- Fix bug where non-string values (numbers, bools) added to `env:` weren't been
|
||||||
|
correctly exported (#1640, #1641 by @vmaerten and @andreynering).
|
||||||
|
|
||||||
## v3.37.0 - 2024-05-08
|
## v3.37.0 - 2024-05-08
|
||||||
|
|
||||||
- Released the
|
- Released the
|
||||||
|
|||||||
@@ -512,7 +512,7 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"exclude": {
|
"exclude": {
|
||||||
"description": "File or glob patter to exclude from the list",
|
"description": "File or glob pattern to exclude from the list",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -648,7 +648,7 @@
|
|||||||
"$ref": "#/definitions/tasks"
|
"$ref": "#/definitions/tasks"
|
||||||
},
|
},
|
||||||
"silent": {
|
"silent": {
|
||||||
"description": "Default 'silent' options for this Taskfile. If `false`, can be overidden with `true` in a task by task basis.",
|
"description": "Default 'silent' options for this Taskfile. If `false`, can be overridden with `true` in a task by task basis.",
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
"set": {
|
"set": {
|
||||||
|
|||||||
@@ -5,6 +5,11 @@ sidebar_position: 14
|
|||||||
|
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## v3.37.1 - 2024-05-09
|
||||||
|
|
||||||
|
- Fix bug where non-string values (numbers, bools) added to `env:` weren't been
|
||||||
|
correctly exported (#1640, #1641 by @vmaerten and @andreynering).
|
||||||
|
|
||||||
## v3.37.0 - 2024-05-08
|
## v3.37.0 - 2024-05-08
|
||||||
|
|
||||||
- Released the
|
- Released the
|
||||||
|
|||||||
Reference in New Issue
Block a user