1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-04-11 11:42:15 +02:00

feat: remove singular snapcraft config (#1281)

Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
This commit is contained in:
Carlos Alexandro Becker 2019-12-27 17:31:03 -03:00 committed by GitHub
parent 885a9710e5
commit 468401bc54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 44 deletions

View File

@ -7,12 +7,13 @@ import (
"os"
"os/exec"
"path/filepath"
"reflect"
"strings"
"github.com/apex/log"
"github.com/pkg/errors"
"gopkg.in/yaml.v2"
"github.com/goreleaser/goreleaser/internal/artifact"
"github.com/goreleaser/goreleaser/internal/deprecate"
"github.com/goreleaser/goreleaser/internal/ids"
"github.com/goreleaser/goreleaser/internal/linux"
"github.com/goreleaser/goreleaser/internal/pipe"
@ -20,8 +21,6 @@ import (
"github.com/goreleaser/goreleaser/internal/tmpl"
"github.com/goreleaser/goreleaser/pkg/config"
"github.com/goreleaser/goreleaser/pkg/context"
"github.com/pkg/errors"
yaml "gopkg.in/yaml.v2"
)
// ErrNoSnapcraft is shown when snapcraft cannot be found in $PATH
@ -67,12 +66,6 @@ func (Pipe) String() string {
// Default sets the pipe defaults
func (Pipe) Default(ctx *context.Context) error {
if len(ctx.Config.Snapcrafts) == 0 {
ctx.Config.Snapcrafts = append(ctx.Config.Snapcrafts, ctx.Config.Snapcraft)
if !reflect.DeepEqual(ctx.Config.Snapcraft, config.Snapcraft{}) {
deprecate.Notice("snapcraft")
}
}
var ids = ids.New("snapcrafts")
for i := range ctx.Config.Snapcrafts {
var snap = &ctx.Config.Snapcrafts[i]

View File

@ -326,6 +326,9 @@ func TestDefault(t *testing.T) {
ID: "foo",
},
},
Snapcrafts: []config.Snapcraft{
{},
},
})
assert.NoError(t, Pipe{}.Default(ctx))
assert.Equal(t, defaultNameTemplate, ctx.Config.Snapcrafts[0].NameTemplate)
@ -357,16 +360,6 @@ func TestDefaultSet(t *testing.T) {
assert.Equal(t, "foo", ctx.Config.Snapcrafts[0].NameTemplate)
}
func TestDefaultDeprecate(t *testing.T) {
var ctx = context.New(config.Project{
Snapcraft: config.Snapcraft{
NameTemplate: "foo",
},
})
assert.NoError(t, Pipe{}.Default(ctx))
assert.Equal(t, "foo", ctx.Config.Snapcrafts[0].NameTemplate)
}
func addBinaries(t *testing.T, ctx *context.Context, name, dist, dest string) {
for _, goos := range []string{"linux", "darwin"} {
for _, goarch := range []string{"amd64", "386", "arm6"} {

View File

@ -361,7 +361,6 @@ type Project struct {
Archive Archive `yaml:",omitempty"` // TODO: remove this
Archives []Archive `yaml:",omitempty"`
NFPMs []NFPM `yaml:"nfpms,omitempty"`
Snapcraft Snapcraft `yaml:",omitempty"` // TODO: remove this
Snapcrafts []Snapcraft `yaml:",omitempty"`
Snapshot Snapshot `yaml:",omitempty"`
Checksum Checksum `yaml:",omitempty"`

View File

@ -175,29 +175,6 @@ blobs:
# etc
```
### snapcraft
> since 2019-05-27
We now allow multiple Snapcraft configs, so the `snapcraft` statement will be removed.
Change this:
```yaml
snapcraft:
publish: true
# ...
```
to this:
```yaml
snapcrafts:
-
publish: true
# ...
```
### archive
> since 2019-04-16
@ -223,6 +200,30 @@ archives:
The following options were deprecated for ~6 months and are now fully removed.
### snapcraft
> since 2019-05-27, removed 2019-12-27
We now allow multiple Snapcraft configs, so the `snapcraft` statement will be removed.
Change this:
```yaml
snapcraft:
publish: true
# ...
```
to this:
```yaml
snapcrafts:
-
publish: true
# ...
```
### nfpm
> since 2019-05-07, removed 2019-12-27