1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

fixing a bug int the fpm pipe, added more tests

This commit is contained in:
Carlos Alexandro Becker 2017-04-22 10:41:58 -03:00
parent 7eb383135e
commit d04efee12d
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
2 changed files with 29 additions and 1 deletions

View File

@ -56,7 +56,7 @@ func (Pipe) Run(ctx *context.Context) error {
func create(ctx *context.Context, format, archive, arch string) error {
var path = filepath.Join(ctx.Config.Dist, archive)
var file = path + ".deb"
var file = path + "." + format
var name = ctx.Config.Build.Binary
log.Println("Creating", file)

View File

@ -76,3 +76,31 @@ func TestNoFPMInPath(t *testing.T) {
}
assert.EqualError(Pipe{}.Run(ctx), ErrNoFPM.Error())
}
func TestCreateFileDoesntExist(t *testing.T) {
var assert = assert.New(t)
folder, err := ioutil.TempDir("", "archivetest")
assert.NoError(err)
var dist = filepath.Join(folder, "dist")
assert.NoError(os.Mkdir(dist, 0755))
assert.NoError(os.Mkdir(filepath.Join(dist, "mybin"), 0755))
var ctx = &context.Context{
Archives: map[string]string{
"linuxamd64": "mybin",
},
Config: config.Project{
Dist: dist,
Build: config.Build{
Goarch: []string{
"amd64",
"i386",
},
Binary: "mybin",
},
FPM: config.FPM{
Formats: []string{"deb"},
},
},
}
assert.Error(Pipe{}.Run(ctx))
}