1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-24 04:16:27 +02:00

Merge pull request #348 from goreleaser/yaml

also accept .yaml files
This commit is contained in:
Carlos Alexandro Becker 2017-08-27 21:27:27 -03:00 committed by GitHub
commit 0a91857ecd
2 changed files with 27 additions and 13 deletions

View File

@ -131,7 +131,12 @@ func getConfigFile(flags Flags) string {
if flags.IsSet("config") {
return config
}
for _, f := range []string{".goreleaser.yml", "goreleaser.yml"} {
for _, f := range []string{
".goreleaser.yml",
".goreleaser.yaml",
"goreleaser.yml",
"goreleaser.yaml",
} {
_, ferr := os.Stat(f)
if ferr == nil || os.IsExist(ferr) {
return f

View File

@ -56,19 +56,28 @@ func TestConfigFileIsSetAndDontExist(t *testing.T) {
}
func TestConfigFlagNotSetButExists(t *testing.T) {
var assert = assert.New(t)
folder, back := setup(t)
defer back()
assert.NoError(
os.Rename(
filepath.Join(folder, "goreleaser.yml"),
filepath.Join(folder, ".goreleaser.yml"),
),
)
var flags = fakeFlags{
flags: map[string]string{},
for _, name := range []string{
".goreleaser.yml",
".goreleaser.yaml",
"goreleaser.yml",
"goreleaser.yaml",
} {
t.Run(name, func(t *testing.T) {
folder, back := setup(t)
defer back()
assert.NoError(
t,
os.Rename(
filepath.Join(folder, "goreleaser.yml"),
filepath.Join(folder, name),
),
)
var flags = fakeFlags{
flags: map[string]string{},
}
assert.Equal(t, name, getConfigFile(flags))
})
}
assert.Equal(".goreleaser.yml", getConfigFile(flags))
}
func TestReleaseNotesFileDontExist(t *testing.T) {