mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-06 03:13:48 +02:00
Allow for non-US spelling of Licence
This commit is contained in:
parent
f5d3c6acf4
commit
0c6e7bcc77
0
config/.test/LICENCE.md
Normal file
0
config/.test/LICENCE.md
Normal file
0
config/.test/LICENSE.md
Normal file
0
config/.test/LICENSE.md
Normal file
0
config/.test/README.md
Normal file
0
config/.test/README.md
Normal file
@ -66,9 +66,12 @@ func Load(file string) (config ProjectConfig, err error) {
|
||||
|
||||
func fix(config ProjectConfig) ProjectConfig {
|
||||
if len(config.Files) == 0 {
|
||||
config.Files = []string{
|
||||
"README.md",
|
||||
"LICENSE.md",
|
||||
config.Files = []string{}
|
||||
|
||||
for _, f := range []string{"README.md", "LICENCE.md", "LICENSE.md"} {
|
||||
if _, err := os.Stat(f); err == nil {
|
||||
config.Files = append(config.Files, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
if config.Token == "" {
|
||||
@ -86,6 +89,7 @@ func fix(config ProjectConfig) ProjectConfig {
|
||||
if len(config.Build.Arches) == 0 {
|
||||
config.Build.Arches = []string{"amd64", "386"}
|
||||
}
|
||||
|
||||
return config
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@ -9,11 +10,30 @@ import (
|
||||
func TestFixConfig(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
config := fix(ProjectConfig{})
|
||||
|
||||
assert.Equal("main.go", config.Build.Main)
|
||||
assert.Contains(config.Files, "README.md")
|
||||
assert.Contains(config.Files, "LICENSE.md")
|
||||
assert.Contains(config.Build.Oses, "darwin")
|
||||
assert.Contains(config.Build.Oses, "linux")
|
||||
assert.Contains(config.Build.Arches, "386")
|
||||
assert.Contains(config.Build.Arches, "amd64")
|
||||
}
|
||||
|
||||
func TestFixConfigMissingFiles(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
config := fix(ProjectConfig{})
|
||||
|
||||
assert.NotContains(config.Files, "README.md")
|
||||
assert.NotContains(config.Files, "LICENSE.md")
|
||||
assert.NotContains(config.Files, "LICENCE.md")
|
||||
}
|
||||
|
||||
func TestFixConfigNoMissingFiles(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
os.Chdir("./.test")
|
||||
config := fix(ProjectConfig{})
|
||||
|
||||
assert.Contains(config.Files, "README.md")
|
||||
assert.Contains(config.Files, "LICENSE.md")
|
||||
assert.Contains(config.Files, "LICENCE.md")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user