Skip to content

Commit

Permalink
fix: homebrew spacing in the formula
Browse files Browse the repository at this point in the history
  • Loading branch information
caarlos0 committed Apr 4, 2018
1 parent ff86787 commit ecce86f
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 159 deletions.
1 change: 0 additions & 1 deletion config/config.go
Expand Up @@ -44,7 +44,6 @@ type Homebrew struct {
Dependencies []string `yaml:",omitempty"`
BuildDependencies []string `yaml:"build_dependencies,omitempty"`
Test string `yaml:",omitempty"`
Special string `yaml:",omitempty"`
Conflicts []string `yaml:",omitempty"`
Description string `yaml:",omitempty"`
Homepage string `yaml:",omitempty"`
Expand Down
6 changes: 0 additions & 6 deletions docs/120-homebrew.md
Expand Up @@ -83,12 +83,6 @@ brew:
system "#{bin}/program --version"
...
# Specify any additional formula content in the special section.
# Default is empty.
special: |
system "make completion"
...
# Custom install script for brew.
# Default is 'bin.install "program"'.
install: |
Expand Down
1 change: 0 additions & 1 deletion pipeline/brew/brew.go
Expand Up @@ -181,7 +181,6 @@ func dataFor(ctx *context.Context, client client.Client, artifact artifact.Artif
Plist: cfg.Plist,
Install: split(cfg.Install),
Tests: split(cfg.Test),
Special: split(cfg.Special),
DownloadStrategy: cfg.DownloadStrategy,
}, nil
}
Expand Down
24 changes: 8 additions & 16 deletions pipeline/brew/template.go
Expand Up @@ -20,31 +20,29 @@ type templateData struct {
BuildDependencies []string
Conflicts []string
Tests []string
Special []string
}

const formulaTemplate = `class {{ .Name }} < Formula
desc "{{ .Desc }}"
homepage "{{ .Homepage }}"
{{- if .BuildDependencies }}
{{ if .BuildDependencies -}}
url "{{ .DownloadURL }}/{{ .Repo.Owner }}/{{ .Repo.Name }}/archive/{{ .Tag }}.tar.gz"
{{ else }}
head "https://github.com/{{ .Repo.Owner }}/{{ .Repo.Name }}.git"
{{- else -}}
url "{{ .DownloadURL }}/{{ .Repo.Owner }}/{{ .Repo.Name }}/releases/download/{{ .Tag }}/{{ .File }}"
{{- if .DownloadStrategy }}, :using => {{ .DownloadStrategy }}{{- end }}
{{- end }}
version "{{ .Version }}"
sha256 "{{ .SHA256 }}"
head "https://github.com/{{ .Repo.Owner }}/{{ .Repo.Name }}.git"
{{- with .BuildDependencies }}
{{ range $index, $element := . }}
depends_on "{{ . }}" => :build
{{ with .Dependencies -}}
{{ range $index, $element := . -}}
depends_on "{{ . }}"
{{- end }}
{{- end -}}
{{- with .Dependencies }}
{{- with .BuildDependencies -}}
{{ range $index, $element := . }}
depends_on "{{ . }}"
depends_on "{{ . }}" => :build
{{- end }}
{{- end -}}
Expand All @@ -54,12 +52,6 @@ const formulaTemplate = `class {{ .Name }} < Formula
{{- end }}
{{- end }}
{{- with .Special }}
{{- range $index, $element := . }}
{{ . -}}
{{- end -}}
{{- end }}
def install
{{- range $index, $element := .Install }}
{{ . -}}
Expand Down
39 changes: 0 additions & 39 deletions pipeline/brew/testdata/build from source.rb.golden

This file was deleted.

10 changes: 3 additions & 7 deletions pipeline/brew/testdata/build_from_source.rb.golden
Expand Up @@ -2,19 +2,15 @@ class BuildFromSource < Formula
desc "A run pipe test formula"
homepage "https://github.com/goreleaser"
url "https://github.com/test/test/archive/v1.0.1.tar.gz"

head "https://github.com/test/test.git"
version "1.0.1"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
head "https://github.com/test/test.git"


depends_on "zsh"depends_on "bash"
depends_on "go" => :build

depends_on "zsh"
depends_on "bash"

conflicts_with "gtk+"
conflicts_with "qt"


def install
bin.install "foo"
Expand Down
36 changes: 0 additions & 36 deletions pipeline/brew/testdata/custom download strategu.rb.golden

This file was deleted.

7 changes: 2 additions & 5 deletions pipeline/brew/testdata/custom_download_strategy.rb.golden
Expand Up @@ -4,14 +4,11 @@ class CustomDownloadStrategy < Formula
url "https://github.com/test/test/releases/download/v1.0.1/bin.tar.gz", :using => GitHubPrivateRepositoryReleaseDownloadStrategy
version "1.0.1"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
head "https://github.com/test/test.git"

depends_on "zsh"
depends_on "bash"

depends_on "zsh"depends_on "bash"

conflicts_with "gtk+"
conflicts_with "qt"


def install
bin.install "foo"
Expand Down
7 changes: 2 additions & 5 deletions pipeline/brew/testdata/default.rb.golden
Expand Up @@ -4,14 +4,11 @@ class Default < Formula
url "https://github.com/test/test/releases/download/v1.0.1/bin.tar.gz"
version "1.0.1"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
head "https://github.com/test/test.git"

depends_on "zsh"
depends_on "bash"

depends_on "zsh"depends_on "bash"

conflicts_with "gtk+"
conflicts_with "qt"


def install
bin.install "foo"
Expand Down
36 changes: 0 additions & 36 deletions pipeline/brew/testdata/github enterprise url.rb.golden

This file was deleted.

7 changes: 2 additions & 5 deletions pipeline/brew/testdata/github_enterprise_url.rb.golden
Expand Up @@ -4,14 +4,11 @@ class GithubEnterpriseUrl < Formula
url "http://github.example.org/test/test/releases/download/v1.0.1/bin.tar.gz"
version "1.0.1"
sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
head "https://github.com/test/test.git"

depends_on "zsh"
depends_on "bash"

depends_on "zsh"depends_on "bash"

conflicts_with "gtk+"
conflicts_with "qt"


def install
bin.install "foo"
Expand Down
3 changes: 1 addition & 2 deletions pipeline/brew/testdata/test.rb.golden
Expand Up @@ -4,8 +4,7 @@ class Test < Formula
url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Darwin_x86_64.tar.gz"
version "0.1.3"
sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c68"
head "https://github.com/caarlos0/test.git"


depends_on "gtk+"

conflicts_with "svn"
Expand Down

0 comments on commit ecce86f

Please sign in to comment.