1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-03-17 20:47:50 +02:00

Merge pull request #11 from goreleaser/win-support

Windows support
This commit is contained in:
Carlos Alexandro Becker 2016-12-30 16:58:26 -02:00 committed by GitHub
commit e3edf89523
4 changed files with 31 additions and 4 deletions

View File

@ -3,5 +3,10 @@ binary_name: release
brew:
repo: goreleaser/homebrew-formulae
build:
arches:
- amd64
arches:
- amd64
- 386
oses:
- windows
- darwin
- linux

View File

@ -51,7 +51,7 @@ func create(system, arch string, config config.ProjectConfig) error {
return err
}
}
if err := addFile(tw, config.BinaryName, binaryName(system, arch, config.BinaryName)); err != nil {
if err := addFile(tw, config.BinaryName+ext(system), binaryPath(system, arch, config.BinaryName)); err != nil {
return err
}
return nil
@ -85,6 +85,13 @@ func nameFor(system, arch, binary string) string {
return binary + "_" + uname.FromGo(system) + "_" + uname.FromGo(arch)
}
func binaryName(system, arch, binary string) string {
func binaryPath(system, arch, binary string) string {
return "dist/" + nameFor(system, arch, binary) + "/" + binary
}
func ext(system string) string {
if system == "windows" {
return ".exe"
}
return ""
}

View File

@ -0,0 +1,14 @@
package compress
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestExtWindows(t *testing.T) {
assert.Equal(t, ext("windows"), ".exe")
}
func TestExtOthers(t *testing.T) {
assert.Empty(t, ext("linux"))
}

View File

@ -6,6 +6,7 @@ var mapping = map[string]string{
"freebsd": "FreeBSD",
"openbsd": "OpenBSD",
"netbsd": "NetBSD",
"windows": "Windows",
"386": "i386",
"amd64": "x86_64",
}