1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-06 03:13:48 +02:00

improvements

This commit is contained in:
Carlos Alexandro Becker 2016-12-29 13:19:03 -02:00
parent 2dd8bfa93d
commit 3bb337840b
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
3 changed files with 19 additions and 26 deletions

View File

@ -24,11 +24,9 @@ const formulae = `class {{ .Name }} < Formula
bin.install "{{ .BinaryName }}"
end
{{ if .Caveats }}
def caveats
{{ if .Caveats }}def caveats
"{{ .Caveats }}"
end
{{ end }}
end{{ end }}
end
`

View File

@ -4,8 +4,6 @@ import (
"testing"
"github.com/stretchr/testify/assert"
"os"
"io/ioutil"
)
func TestNameWithDash(t *testing.T) {
@ -20,6 +18,22 @@ func TestSimpleName(t *testing.T) {
assert.Equal(t, formulaNameFor("binary"), "Binary")
}
var testFormulaeExpected = `class Test < Formula
desc "Some desc"
homepage "https://google.com"
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_#{%x(uname -s).gsub(/\n/, '')}_#{%x(uname -m).gsub(/\n/, '')}.tar.gz"
head "https://github.com/caarlos0/test.git"
version "v0.1.3"
def install
bin.install "test"
end
def caveats
"Here are some caveats"
end
end
`
func TestFormulae(t *testing.T) {
assert := assert.New(t)
@ -33,8 +47,6 @@ func TestFormulae(t *testing.T) {
Caveats: "Here are some caveats",
})
assert.NoError(err)
f, err := os.Open("./brew/test_files/test.txt")
bts, _ := ioutil.ReadAll(f)
assert.NoError(err)
assert.Equal(string(bts), out.String())
assert.Equal(testFormulaeExpected, out.String())
}

View File

@ -1,17 +0,0 @@
class Test < Formula
desc "Some desc"
homepage "https://google.com"
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_#{%x(uname -s).gsub(/\n/, '')}_#{%x(uname -m).gsub(/\n/, '')}.tar.gz"
head "https://github.com/caarlos0/test.git"
version "v0.1.3"
def install
bin.install "test"
end
def caveats
"Here are some caveats"
end
end