Skip to content

Commit

Permalink
feat: remove deprecated blob and sign (#1397)
Browse files Browse the repository at this point in the history
* feat: remove deprecated blob and sign

you should now use blobs and signs instead.

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>

* fix: tests

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
  • Loading branch information
caarlos0 committed Mar 22, 2020
1 parent 22c9e04 commit 0126a1f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 40 deletions.
5 changes: 0 additions & 5 deletions internal/pipe/blob/blob.go
Expand Up @@ -4,7 +4,6 @@ import (
"fmt"
"strings"

"github.com/goreleaser/goreleaser/internal/deprecate"
"github.com/goreleaser/goreleaser/internal/pipe"
"github.com/goreleaser/goreleaser/internal/semerrgroup"
"github.com/goreleaser/goreleaser/pkg/context"
Expand All @@ -20,10 +19,6 @@ func (Pipe) String() string {

// Default sets the pipe defaults
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 {
blob := &ctx.Config.Blobs[i]

Expand Down
11 changes: 0 additions & 11 deletions internal/pipe/blob/blob_test.go
Expand Up @@ -62,12 +62,6 @@ func TestDefaultsNoProvider(t *testing.T) {

func TestDefaults(t *testing.T) {
var ctx = context.New(config.Project{
Blob: []config.Blob{
{
Bucket: "foobar",
Provider: "gcs",
},
},
Blobs: []config.Blob{
{
Bucket: "foo",
Expand All @@ -84,11 +78,6 @@ func TestDefaults(t *testing.T) {
Folder: "{{ .ProjectName }}/{{ .Tag }}",
IDs: []string{"foo", "bar"},
},
{
Bucket: "foobar",
Provider: "gcs",
Folder: "{{ .ProjectName }}/{{ .Tag }}",
},
}, ctx.Config.Blobs)
}

Expand Down
8 changes: 0 additions & 8 deletions internal/pipe/sign/sign.go
Expand Up @@ -5,11 +5,9 @@ import (
"os"
"os/exec"
"path/filepath"
"reflect"

"github.com/apex/log"
"github.com/goreleaser/goreleaser/internal/artifact"
"github.com/goreleaser/goreleaser/internal/deprecate"
"github.com/goreleaser/goreleaser/internal/ids"
"github.com/goreleaser/goreleaser/internal/logext"
"github.com/goreleaser/goreleaser/internal/pipe"
Expand All @@ -27,12 +25,6 @@ func (Pipe) String() string {

// Default sets the Pipes defaults.
func (Pipe) Default(ctx *context.Context) error {
if len(ctx.Config.Signs) == 0 {
ctx.Config.Signs = append(ctx.Config.Signs, ctx.Config.Sign)
if !reflect.DeepEqual(ctx.Config.Sign, config.Sign{}) {
deprecate.Notice("sign")
}
}
var ids = ids.New("signs")
for i := range ctx.Config.Signs {
cfg := &ctx.Config.Signs[i]
Expand Down
20 changes: 13 additions & 7 deletions internal/pipe/sign/sign_test.go
Expand Up @@ -40,7 +40,11 @@ func TestDescription(t *testing.T) {
}

func TestSignDefault(t *testing.T) {
ctx := &context.Context{}
ctx := &context.Context{
Config: config.Project{
Signs: []config.Sign{{}},
},
}
err := Pipe{}.Default(ctx)
assert.NoError(t, err)
assert.Equal(t, ctx.Config.Signs[0].Cmd, "gpg")
Expand Down Expand Up @@ -87,10 +91,12 @@ func TestSignArtifacts(t *testing.T) {
expectedErrMsg: "sign: exit failed",
ctx: context.New(
config.Project{
Sign: config.Sign{
Artifacts: "all",
Cmd: "exit",
Args: []string{"1"},
Signs: []config.Sign{
{
Artifacts: "all",
Cmd: "exit",
Args: []string{"1"},
},
},
},
),
Expand All @@ -99,8 +105,8 @@ func TestSignArtifacts(t *testing.T) {
desc: "sign single",
ctx: context.New(
config.Project{
Sign: config.Sign{
Artifacts: "all",
Signs: []config.Sign{
{Artifacts: "all"},
},
},
),
Expand Down
4 changes: 1 addition & 3 deletions pkg/config/config.go
Expand Up @@ -366,12 +366,10 @@ type Project struct {
Dockers []Docker `yaml:",omitempty"`
Artifactories []Upload `yaml:",omitempty"`
Uploads []Upload `yaml:",omitempty"`
Puts []Upload `yaml:",omitempty"` // TODO: remove this
Blob []Blob `yaml:"blob,omitempty"` // TODO: remove this
Puts []Upload `yaml:",omitempty"` // TODO: remove this
Blobs []Blob `yaml:"blobs,omitempty"`
Changelog Changelog `yaml:",omitempty"`
Dist string `yaml:",omitempty"`
Sign Sign `yaml:",omitempty"` // TODO: remove this
Signs []Sign `yaml:",omitempty"`
EnvFiles EnvFiles `yaml:"env_files,omitempty"`
Before Before `yaml:",omitempty"`
Expand Down
11 changes: 5 additions & 6 deletions www/content/deprecations.md
Expand Up @@ -85,10 +85,13 @@ nfpms:
- file_name_template: foo
```

## Expired deprecation notices

The following options were deprecated for ~6 months and are now fully removed.

### blob

> since 2019-08-02
> since 2019-08-02, removed 2020-03-22
Blob was deprecated in favor of its plural form.
It was already accepting multiple inputs, but its pluralized now so its more
Expand All @@ -110,7 +113,7 @@ blobs:

### sign

> since 2019-07-20
> since 2019-07-20, removed 2020-03-22
Sign was deprecated in favor of its plural form.

Expand All @@ -129,10 +132,6 @@ signs:
# etc
```

## Expired deprecation notices

The following options were deprecated for ~6 months and are now fully removed.

### brew

> since 2019-06-09, removed 2020-01-26
Expand Down

0 comments on commit 0126a1f

Please sign in to comment.