You've already forked goreleaser
mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-07-15 01:34:21 +02:00
fix: pluralize blob in the config file (#1095)
* fix: pluralize blob in the config file Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com> * test: added tests Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
committed by
GitHub
parent
7871c58ac2
commit
844f95a2d0
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/goreleaser/goreleaser/internal/deprecate"
|
||||||
"github.com/goreleaser/goreleaser/internal/pipe"
|
"github.com/goreleaser/goreleaser/internal/pipe"
|
||||||
"github.com/goreleaser/goreleaser/internal/semerrgroup"
|
"github.com/goreleaser/goreleaser/internal/semerrgroup"
|
||||||
"github.com/goreleaser/goreleaser/internal/tmpl"
|
"github.com/goreleaser/goreleaser/internal/tmpl"
|
||||||
@ -21,6 +22,10 @@ func (Pipe) String() string {
|
|||||||
|
|
||||||
// Default sets the pipe defaults
|
// Default sets the pipe defaults
|
||||||
func (Pipe) Default(ctx *context.Context) error {
|
func (Pipe) Default(ctx *context.Context) error {
|
||||||
|
if len(ctx.Config.Blob) > 0 {
|
||||||
|
deprecate.Notice("blob")
|
||||||
|
ctx.Config.Blobs = append(ctx.Config.Blobs, ctx.Config.Blob...)
|
||||||
|
}
|
||||||
for i := range ctx.Config.Blobs {
|
for i := range ctx.Config.Blobs {
|
||||||
blob := &ctx.Config.Blobs[i]
|
blob := &ctx.Config.Blobs[i]
|
||||||
|
|
||||||
|
@ -7,6 +7,8 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/goreleaser/goreleaser/internal/artifact"
|
"github.com/goreleaser/goreleaser/internal/artifact"
|
||||||
"github.com/goreleaser/goreleaser/internal/testlib"
|
"github.com/goreleaser/goreleaser/internal/testlib"
|
||||||
"github.com/goreleaser/goreleaser/pkg/config"
|
"github.com/goreleaser/goreleaser/pkg/config"
|
||||||
@ -15,7 +17,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestDescription(t *testing.T) {
|
func TestDescription(t *testing.T) {
|
||||||
assert.NotEmpty(t, Pipe{}.String())
|
require.NotEmpty(t, Pipe{}.String())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestNoBlob(t *testing.T) {
|
func TestNoBlob(t *testing.T) {
|
||||||
@ -60,8 +62,13 @@ func TestDefaultsNoProvider(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDefaults(t *testing.T) {
|
func TestDefaults(t *testing.T) {
|
||||||
var assert = assert.New(t)
|
|
||||||
var ctx = context.New(config.Project{
|
var ctx = context.New(config.Project{
|
||||||
|
Blob: []config.Blob{
|
||||||
|
{
|
||||||
|
Bucket: "foobar",
|
||||||
|
Provider: "gcs",
|
||||||
|
},
|
||||||
|
},
|
||||||
Blobs: []config.Blob{
|
Blobs: []config.Blob{
|
||||||
{
|
{
|
||||||
Bucket: "foo",
|
Bucket: "foo",
|
||||||
@ -70,13 +77,20 @@ func TestDefaults(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
assert.NoError(Pipe{}.Default(ctx))
|
require.NoError(t, Pipe{}.Default(ctx))
|
||||||
assert.Equal([]config.Blob{{
|
require.Equal(t, []config.Blob{
|
||||||
|
{
|
||||||
Bucket: "foo",
|
Bucket: "foo",
|
||||||
Provider: "azblob",
|
Provider: "azblob",
|
||||||
Folder: "{{ .ProjectName }}/{{ .Tag }}",
|
Folder: "{{ .ProjectName }}/{{ .Tag }}",
|
||||||
IDs: []string{"foo", "bar"},
|
IDs: []string{"foo", "bar"},
|
||||||
}}, ctx.Config.Blobs)
|
},
|
||||||
|
{
|
||||||
|
Bucket: "foobar",
|
||||||
|
Provider: "gcs",
|
||||||
|
Folder: "{{ .ProjectName }}/{{ .Tag }}",
|
||||||
|
},
|
||||||
|
}, ctx.Config.Blobs)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestDefaultsWithProvider(t *testing.T) {
|
func TestDefaultsWithProvider(t *testing.T) {
|
||||||
|
@ -354,7 +354,8 @@ type Project struct {
|
|||||||
Artifactories []Put `yaml:",omitempty"`
|
Artifactories []Put `yaml:",omitempty"`
|
||||||
Puts []Put `yaml:",omitempty"`
|
Puts []Put `yaml:",omitempty"`
|
||||||
S3 []S3 `yaml:"s3,omitempty"`
|
S3 []S3 `yaml:"s3,omitempty"`
|
||||||
Blobs []Blob `yaml:"blob,omitempty"`
|
Blob []Blob `yaml:"blob,omitempty"` // TODO: remove this
|
||||||
|
Blobs []Blob `yaml:"blobs,omitempty"`
|
||||||
Changelog Changelog `yaml:",omitempty"`
|
Changelog Changelog `yaml:",omitempty"`
|
||||||
Dist string `yaml:",omitempty"`
|
Dist string `yaml:",omitempty"`
|
||||||
Sign Sign `yaml:",omitempty"` // TODO: remove this
|
Sign Sign `yaml:",omitempty"` // TODO: remove this
|
||||||
|
@ -7,7 +7,7 @@ series: customization
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# .goreleaser.yml
|
# .goreleaser.yml
|
||||||
blob:
|
blobs:
|
||||||
# You can have multiple blob configs
|
# You can have multiple blob configs
|
||||||
-
|
-
|
||||||
# Template for the cloud provider name
|
# Template for the cloud provider name
|
||||||
|
@ -34,6 +34,28 @@ to this:
|
|||||||
-->
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
### blob
|
||||||
|
|
||||||
|
> since 2019-08-02
|
||||||
|
|
||||||
|
Blob was deprecated in favor of its plural form.
|
||||||
|
It was already accepting multiple inputs, but its pluralized now so its more
|
||||||
|
clear.
|
||||||
|
|
||||||
|
Change this:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
blob:
|
||||||
|
# etc
|
||||||
|
```
|
||||||
|
|
||||||
|
to this:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
blobs:
|
||||||
|
# etc
|
||||||
|
```
|
||||||
|
|
||||||
### sign
|
### sign
|
||||||
|
|
||||||
> since 2019-07-20
|
> since 2019-07-20
|
||||||
@ -95,7 +117,7 @@ s3:
|
|||||||
to this:
|
to this:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
blob:
|
blobs:
|
||||||
-
|
-
|
||||||
provider: s3
|
provider: s3
|
||||||
# etc
|
# etc
|
||||||
|
Reference in New Issue
Block a user