mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-20 03:59:26 +02:00
fix: wrap snapcraft command in TrimSpace (#1035)
This commit is contained in:
parent
24c9a4e6f5
commit
3eec7e3e9d
@ -202,10 +202,10 @@ func create(ctx *context.Context, snap config.Snapcraft, arch string, binaries [
|
||||
if configAppMetadata, ok := snap.Apps[name]; ok {
|
||||
appMetadata.Plugs = configAppMetadata.Plugs
|
||||
appMetadata.Daemon = configAppMetadata.Daemon
|
||||
appMetadata.Command = strings.Join([]string{
|
||||
appMetadata.Command = strings.TrimSpace(strings.Join([]string{
|
||||
appMetadata.Command,
|
||||
configAppMetadata.Args,
|
||||
}, " ")
|
||||
}, " "))
|
||||
}
|
||||
metadata.Apps[name] = appMetadata
|
||||
metadata.Plugs = snap.Plugs
|
||||
|
@ -245,6 +245,43 @@ func TestNoSnapcraftInPath(t *testing.T) {
|
||||
assert.EqualError(t, Pipe{}.Run(ctx), ErrNoSnapcraft.Error())
|
||||
}
|
||||
|
||||
|
||||
func TestRunNoArguments(t *testing.T) {
|
||||
folder, err := ioutil.TempDir("", "archivetest")
|
||||
assert.NoError(t, err)
|
||||
var dist = filepath.Join(folder, "dist")
|
||||
assert.NoError(t, os.Mkdir(dist, 0755))
|
||||
assert.NoError(t, err)
|
||||
var ctx = context.New(config.Project{
|
||||
ProjectName: "testprojectname",
|
||||
Dist: dist,
|
||||
Snapcrafts: []config.Snapcraft{
|
||||
{
|
||||
NameTemplate: "foo_{{.Arch}}",
|
||||
Summary: "test summary",
|
||||
Description: "test description",
|
||||
Apps: map[string]config.SnapcraftAppMetadata{
|
||||
"mybin": {
|
||||
Daemon: "simple",
|
||||
Args: "",
|
||||
},
|
||||
},
|
||||
Builds: []string{"foo"},
|
||||
},
|
||||
},
|
||||
})
|
||||
ctx.Git.CurrentTag = "v1.2.3"
|
||||
ctx.Version = "v1.2.3"
|
||||
addBinaries(t, ctx, "foo", dist, "mybin")
|
||||
assert.NoError(t, Pipe{}.Run(ctx))
|
||||
yamlFile, err := ioutil.ReadFile(filepath.Join(dist, "foo_amd64", "prime", "meta", "snap.yaml"))
|
||||
assert.NoError(t, err)
|
||||
var metadata Metadata
|
||||
err = yaml.Unmarshal(yamlFile, &metadata)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "mybin", metadata.Apps["mybin"].Command)
|
||||
}
|
||||
|
||||
func TestDefault(t *testing.T) {
|
||||
var ctx = context.New(config.Project{
|
||||
Builds: []config.Build{
|
||||
|
Loading…
x
Reference in New Issue
Block a user