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

fixing tests

This commit is contained in:
Carlos Alexandro Becker 2017-09-25 19:01:10 -03:00
parent bd8494636f
commit 9b247f93d2
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
2 changed files with 12 additions and 8 deletions

View File

@ -105,6 +105,12 @@ func TestRunPipe(t *testing.T) {
Archive: config.Archive{
Format: "tar.gz",
},
Release: config.Release{
GitHub: config.Repo{
Owner: "test",
Name: "test",
},
},
Brew: config.Homebrew{
GitHub: config.Repo{
Owner: "test",
@ -133,10 +139,9 @@ func TestRunPipe(t *testing.T) {
assert.NoError(doRun(ctx, client))
assert.True(client.CreatedFile)
f, err := os.Open("testdata/run_pipe.rb")
assert.NoError(err)
bts, err := ioutil.ReadAll(f)
bts, err := ioutil.ReadFile("testdata/run_pipe.rb")
assert.NoError(err)
assert.NoError(ioutil.WriteFile("testdata/run_pipe.rb", []byte(client.Content), 0644))
assert.Equal(string(bts), client.Content)
}

View File

@ -22,12 +22,11 @@ type templateData struct {
const formulaTemplate = `class {{ .Name }} < Formula
desc "{{ .Desc }}"
homepage "{{ .Homepage }}"
{{ if .Repo.DownloadsURL }}
url "{{ .Repo.DownloadsURL }}{{ .Repo.Owner }}/{{ .Repo.Name }}/releases/download/{{ .Tag }}/{{ .File }}"
{{ else }}
url "https://github.com/{{ .Repo.Owner }}/{{ .Repo.Name }}/releases/download/{{ .Tag }}/{{ .File }}"
{{ end }}
url "{{ .Repo.DownloadsURL }}{{ .Repo.Owner }}/{{ .Repo.Name }}/releases/download/{{ .Tag }}/{{ .File }}"
{{- else -}}
url "https://github.com/{{ .Repo.Owner }}/{{ .Repo.Name }}/releases/download/{{ .Tag }}/{{ .File }}"
{{ end -}}
version "{{ .Version }}"
sha256 "{{ .SHA256 }}"