-
-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from goreleaser/recommends
feat: support recommending and suggesting packages
- Loading branch information
Showing
11 changed files
with
465 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,8 @@ provides: | |
depends: | ||
- foo | ||
- bar | ||
recommends: | ||
- whatever | ||
conflicts: | ||
- not-foo | ||
- not-bar | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,71 @@ | ||
package deb | ||
|
||
import ( | ||
"bytes" | ||
"flag" | ||
"io/ioutil" | ||
"testing" | ||
|
||
"github.com/goreleaser/nfpm" | ||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
var update = flag.Bool("update", false, "update .golden files") | ||
|
||
var info = nfpm.WithDefaults(nfpm.Info{ | ||
Name: "foo", | ||
Arch: "amd64", | ||
Depends: []string{ | ||
"bash", | ||
}, | ||
Recommends: []string{ | ||
"git", | ||
}, | ||
Suggests: []string{ | ||
"bash", | ||
}, | ||
Replaces: []string{ | ||
"svn", | ||
}, | ||
Provides: []string{ | ||
"bzr", | ||
}, | ||
Conflicts: []string{ | ||
"zsh", | ||
}, | ||
Description: "Foo does things", | ||
Priority: "extra", | ||
Maintainer: "Carlos A Becker <[email protected]>", | ||
Version: "1.0.0", | ||
Section: "default", | ||
Homepage: "http://carlosbecker.com", | ||
Vendor: "nope", | ||
Files: map[string]string{ | ||
"../testdata/fake": "/usr/local/bin/fake", | ||
}, | ||
ConfigFiles: map[string]string{ | ||
"../testdata/whatever.conf": "/etc/fake/fake.conf", | ||
}, | ||
}) | ||
|
||
func TestDeb(t *testing.T) { | ||
var err = Default.Package( | ||
nfpm.WithDefaults(nfpm.Info{ | ||
Name: "foo", | ||
Arch: "amd64", | ||
Depends: []string{ | ||
"bash", | ||
}, | ||
Description: "Foo does things", | ||
Priority: "extra", | ||
Maintainer: "Carlos A Becker <[email protected]>", | ||
Version: "1.0.0", | ||
Section: "default", | ||
Homepage: "http://carlosbecker.com", | ||
Vendor: "nope", | ||
Files: map[string]string{ | ||
"../testdata/fake": "/usr/local/bin/fake", | ||
}, | ||
ConfigFiles: map[string]string{ | ||
"../testdata/whatever.conf": "/etc/fake/fake.conf", | ||
}, | ||
}), | ||
ioutil.Discard, | ||
) | ||
var err = Default.Package(info, ioutil.Discard) | ||
assert.NoError(t, err) | ||
} | ||
|
||
func TestControl(t *testing.T) { | ||
var w bytes.Buffer | ||
assert.NoError(t, writeControl(&w, controlData{ | ||
Info: info, | ||
InstalledSize: 10, | ||
})) | ||
var golden = "testdata/control.golden" | ||
if *update { | ||
ioutil.WriteFile(golden, w.Bytes(), 0655) | ||
} | ||
bts, err := ioutil.ReadFile(golden) | ||
assert.NoError(t, err) | ||
assert.Equal(t, string(bts), w.String()) | ||
} | ||
|
||
func TestDebFileDoesNotExist(t *testing.T) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
Package: foo | ||
Version: 1.0.0 | ||
Section: default | ||
Priority: extra | ||
Architecture: amd64 | ||
Maintainer: Carlos A Becker <[email protected]> | ||
Vendor: nope | ||
Installed-Size: 10 | ||
Replaces: svn | ||
Provides: bzr | ||
Depends: bash | ||
Recommends: git | ||
Recommends: bash | ||
Conflicts: zsh | ||
Homepage: http://carlosbecker.com | ||
Description: Foo does things |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.