1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-25 21:29:14 +02:00

feat: Add default command for snapcraft (#749)

This commit is contained in:
Grachev Mikhail 2018-08-15 15:38:42 +03:00 committed by Carlos Alexandro Becker
parent 838c1cd50d
commit a91c8fd185
3 changed files with 10 additions and 1 deletions

View File

@ -160,6 +160,13 @@ func create(ctx *context.Context, arch string, binaries []artifact.Artifact) err
return err
}
}
if _, ok := metadata.Apps[metadata.Name]; !ok {
metadata.Apps[metadata.Name] = AppMetadata{
Command: binaries[0].Name,
}
}
out, err := yaml.Marshal(metadata)
if err != nil {
return err

View File

@ -108,6 +108,8 @@ func TestRunPipeWithName(t *testing.T) {
err = yaml.Unmarshal(yamlFile, &metadata)
assert.NoError(t, err)
assert.Equal(t, metadata.Name, "testsnapname")
assert.Equal(t, metadata.Apps["mybin"].Command, "mybin")
assert.Equal(t, metadata.Apps["testsnapname"].Command, "mybin")
}
func TestRunPipeMetadata(t *testing.T) {

View File

@ -69,7 +69,7 @@ snapcraft:
# you can declare extra details for those binaries. It is optional.
apps:
# The name of the app must be the same name as the binary built.
# The name of the app must be the same name as the binary built or the snapcraft name.
drumroll:
# If your app requires extra permissions to work outside of its default