1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-09 13:36:56 +02:00

template ok

This commit is contained in:
Carlos Alexandro Becker 2017-07-16 15:13:30 -03:00
parent a3db024e98
commit 871a615c06
No known key found for this signature in database
GPG Key ID: E61E2F7DC14AB940
5 changed files with 5 additions and 42 deletions

View File

@ -5,7 +5,6 @@ package brew
import (
"bytes"
"errors"
"fmt"
"path/filepath"
"strings"
"text/template"
@ -49,7 +48,7 @@ func doRun(ctx *context.Context, client client.Client) error {
log.Warn("skipped because release is marked as draft")
return nil
}
if ctx.Config.Archive.Format == "binary" && len(ctx.Config.Builds) > 1 {
if ctx.Config.Archive.Format == "binary" { //} && len(ctx.Config.Builds) > 1 {
log.Warn("brew formulas can't be generated with multiple builds released in binary format")
return nil
}
@ -70,8 +69,7 @@ func doRun(ctx *context.Context, client client.Client) error {
if err != nil {
return err
}
fmt.Println(content.String())
return nil //client.CreateFile(ctx, content, path)
return client.CreateFile(ctx, content, path)
}
func buildFormula(ctx *context.Context, client client.Client, folder string) (bytes.Buffer, error) {

View File

@ -2,7 +2,6 @@ package brew
import (
"bytes"
"fmt"
"io/ioutil"
"os"
"path/filepath"
@ -70,9 +69,6 @@ func TestFullFormulae(t *testing.T) {
bts, err := ioutil.ReadAll(f)
assert.NoError(err)
f2, err := os.Create("testdata/full_formula.rb")
assert.NoError(err)
fmt.Fprintf(f2, formulae)
assert.Equal(string(bts), formulae)
}

View File

@ -27,13 +27,14 @@ const formulaTemplate = `class {{ .Name }} < Formula
sha256 "{{ .SHA256 }}"
{{- if .Dependencies }}
{{ range $index, $element := .Dependencies }}
{{ range $index, $element := .Dependencies -}}
depends_on "{{ . }}"
{{- end }}
{{- end -}}
{{- if .Conflicts }}
{{ range $index, $element := .Conflicts }}
{{ range $index, $element := .Conflicts -}}
conflicts_with "{{ . }}"
{{- end }}
{{- end }}

View File

@ -1,31 +0,0 @@
class Test < Formula
desc "Some desc"
homepage "https://google.com"
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Darwin_x86_64.tar.gz"
version "0.1.3"
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c68"
depends_on "gtk+"
conflicts_with "svn"
def install
custom install script
another install script
end
def caveats
"Here are some caveats"
end
plist_options :startup => false
def plist; <<-EOS.undent
it works
EOS
end
test do
system "#{bin}/foo -version"
end
end

View File

@ -6,7 +6,6 @@ class Test < Formula
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c68"
depends_on "gtk+"
conflicts_with "svn"
def install