mirror of
https://github.com/goreleaser/goreleaser.git
synced 2024-12-31 01:53:50 +02:00
4162772819
allows to load the config from stdin, so things like: ```sh cat .goreleaser.yml | sed 's/something/else/g' | goreleaser release -f - ``` will now work. closes #3125 Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
49 lines
1.1 KiB
Go
49 lines
1.1 KiB
Go
package cmd
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
|
|
"github.com/goreleaser/goreleaser/pkg/config"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestConfigFlagNotSetButExists(t *testing.T) {
|
|
for _, name := range []string{
|
|
".goreleaser.yml",
|
|
".goreleaser.yaml",
|
|
"goreleaser.yml",
|
|
"goreleaser.yaml",
|
|
} {
|
|
t.Run(name, func(t *testing.T) {
|
|
folder := setup(t)
|
|
require.NoError(t, os.Rename(
|
|
filepath.Join(folder, "goreleaser.yml"),
|
|
filepath.Join(folder, name),
|
|
))
|
|
proj, err := loadConfig("")
|
|
require.NoError(t, err)
|
|
require.NotEqual(t, config.Project{}, proj)
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestConfigFileDoesntExist(t *testing.T) {
|
|
folder := setup(t)
|
|
err := os.Remove(filepath.Join(folder, "goreleaser.yml"))
|
|
require.NoError(t, err)
|
|
proj, err := loadConfig("")
|
|
require.NoError(t, err)
|
|
require.Equal(t, config.Project{}, proj)
|
|
}
|
|
|
|
func TestConfigFileFromStdin(t *testing.T) {
|
|
folder := setup(t)
|
|
err := os.Remove(filepath.Join(folder, "goreleaser.yml"))
|
|
require.NoError(t, err)
|
|
proj, err := loadConfig("-")
|
|
require.NoError(t, err)
|
|
require.Equal(t, config.Project{}, proj)
|
|
}
|