From 588d8aa8ca516fd6cc833d86f523da598a837419 Mon Sep 17 00:00:00 2001 From: Carlos A Becker Date: Mon, 1 Aug 2022 16:14:50 -0300 Subject: [PATCH] fix: brew style closes #3236 Signed-off-by: Carlos A Becker --- internal/pipe/brew/template.go | 26 +++++++++---------- .../brew/testdata/TestFullFormulae.rb.golden | 8 +++--- .../TestFullPipe/custom_block.rb.golden | 12 ++++----- .../custom_download_strategy.rb.golden | 12 ++++----- .../TestFullPipe/custom_require.rb.golden | 12 ++++----- .../testdata/TestFullPipe/default.rb.golden | 12 ++++----- .../TestFullPipe/default_gitlab.rb.golden | 12 ++++----- .../valid_tap_templates.rb.golden | 12 ++++----- .../multiple_armv5.rb.golden | 12 ++++----- .../multiple_armv6.rb.golden | 12 ++++----- .../multiple_armv7.rb.golden | 12 ++++----- 11 files changed, 71 insertions(+), 71 deletions(-) diff --git a/internal/pipe/brew/template.go b/internal/pipe/brew/template.go index c66c26f7df7..a0ae2e0e217 100644 --- a/internal/pipe/brew/template.go +++ b/internal/pipe/brew/template.go @@ -45,6 +45,19 @@ class {{ .Name }} < Formula {{- if .License }} license "{{ .License }}" {{- end }} + {{- with .Dependencies }} + {{ range $index, $element := . }} + depends_on "{{ .Name }}" + {{- if .Type }} => :{{ .Type }}{{- end }} + {{- end }} + {{- end -}} + + {{- with .Conflicts }} + {{ range $index, $element := . }} + conflicts_with "{{ . }}" + {{- end }} + {{- end }} + {{- if and (not .LinuxPackages) .MacOSPackages }} depends_on :macos {{- end }} @@ -142,19 +155,6 @@ class {{ .Name }} < Formula {{- end }} {{- end }} - {{- with .Dependencies }} - {{ range $index, $element := . }} - depends_on "{{ .Name }}" - {{- if .Type }} => :{{ .Type }}{{- end }} - {{- end }} - {{- end -}} - - {{- with .Conflicts }} - {{ range $index, $element := . }} - conflicts_with "{{ . }}" - {{- end }} - {{- end }} - {{- with .PostInstall }} def post_install diff --git a/internal/pipe/brew/testdata/TestFullFormulae.rb.golden b/internal/pipe/brew/testdata/TestFullFormulae.rb.golden index 3c995e35e87..78b50d6569a 100644 --- a/internal/pipe/brew/testdata/TestFullFormulae.rb.golden +++ b/internal/pipe/brew/testdata/TestFullFormulae.rb.golden @@ -8,6 +8,10 @@ class Test < Formula version "0.1.3" license "MIT" + depends_on "gtk+" + + conflicts_with "svn" + on_macos do if Hardware::CPU.intel? url "https://github.com/caarlos0/test/releases/download/v0.1.3/test_Darwin_x86_64.tar.gz" @@ -59,10 +63,6 @@ class Test < Formula sha256 "1633f61598ab0791e213135923624eb342196b3494909c91899bcd0560f84c68" end - depends_on "gtk+" - - conflicts_with "svn" - def post_install system "touch", "/tmp/foo" system "echo", "done" diff --git a/internal/pipe/brew/testdata/TestFullPipe/custom_block.rb.golden b/internal/pipe/brew/testdata/TestFullPipe/custom_block.rb.golden index 87289275dd7..360fedf3423 100644 --- a/internal/pipe/brew/testdata/TestFullPipe/custom_block.rb.golden +++ b/internal/pipe/brew/testdata/TestFullPipe/custom_block.rb.golden @@ -6,6 +6,12 @@ class CustomBlock < Formula desc "A run pipe test formula and FOO=foo_is_bar" homepage "https://github.com/goreleaser" version "1.0.1" + + depends_on "zsh" => :optional + depends_on "bash" + + conflicts_with "gtk+" + conflicts_with "qt" depends_on :macos on_macos do @@ -29,12 +35,6 @@ class CustomBlock < Formula head "https://github.com/caarlos0/test.git" - depends_on "zsh" => :optional - depends_on "bash" - - conflicts_with "gtk+" - conflicts_with "qt" - def post_install system "echo" system "touch" "/tmp/hi" diff --git a/internal/pipe/brew/testdata/TestFullPipe/custom_download_strategy.rb.golden b/internal/pipe/brew/testdata/TestFullPipe/custom_download_strategy.rb.golden index 450351e5844..9d316d65a33 100644 --- a/internal/pipe/brew/testdata/TestFullPipe/custom_download_strategy.rb.golden +++ b/internal/pipe/brew/testdata/TestFullPipe/custom_download_strategy.rb.golden @@ -6,6 +6,12 @@ class CustomDownloadStrategy < Formula desc "A run pipe test formula and FOO=foo_is_bar" homepage "https://github.com/goreleaser" version "1.0.1" + + depends_on "zsh" => :optional + depends_on "bash" + + conflicts_with "gtk+" + conflicts_with "qt" depends_on :macos on_macos do @@ -27,12 +33,6 @@ class CustomDownloadStrategy < Formula end end - depends_on "zsh" => :optional - depends_on "bash" - - conflicts_with "gtk+" - conflicts_with "qt" - def post_install system "echo" system "touch" "/tmp/hi" diff --git a/internal/pipe/brew/testdata/TestFullPipe/custom_require.rb.golden b/internal/pipe/brew/testdata/TestFullPipe/custom_require.rb.golden index baa5b40ebd3..163a6330e83 100644 --- a/internal/pipe/brew/testdata/TestFullPipe/custom_require.rb.golden +++ b/internal/pipe/brew/testdata/TestFullPipe/custom_require.rb.golden @@ -7,6 +7,12 @@ class CustomRequire < Formula desc "A run pipe test formula and FOO=foo_is_bar" homepage "https://github.com/goreleaser" version "1.0.1" + + depends_on "zsh" => :optional + depends_on "bash" + + conflicts_with "gtk+" + conflicts_with "qt" depends_on :macos on_macos do @@ -28,12 +34,6 @@ class CustomRequire < Formula end end - depends_on "zsh" => :optional - depends_on "bash" - - conflicts_with "gtk+" - conflicts_with "qt" - def post_install system "echo" system "touch" "/tmp/hi" diff --git a/internal/pipe/brew/testdata/TestFullPipe/default.rb.golden b/internal/pipe/brew/testdata/TestFullPipe/default.rb.golden index 8501ec49a97..fe89cfa70b6 100644 --- a/internal/pipe/brew/testdata/TestFullPipe/default.rb.golden +++ b/internal/pipe/brew/testdata/TestFullPipe/default.rb.golden @@ -6,6 +6,12 @@ class Default < Formula desc "A run pipe test formula and FOO=foo_is_bar" homepage "https://github.com/goreleaser" version "1.0.1" + + depends_on "zsh" => :optional + depends_on "bash" + + conflicts_with "gtk+" + conflicts_with "qt" depends_on :macos on_macos do @@ -27,12 +33,6 @@ class Default < Formula end end - depends_on "zsh" => :optional - depends_on "bash" - - conflicts_with "gtk+" - conflicts_with "qt" - def post_install system "echo" system "touch" "/tmp/hi" diff --git a/internal/pipe/brew/testdata/TestFullPipe/default_gitlab.rb.golden b/internal/pipe/brew/testdata/TestFullPipe/default_gitlab.rb.golden index 64378d0a108..6cbd5c00d3c 100644 --- a/internal/pipe/brew/testdata/TestFullPipe/default_gitlab.rb.golden +++ b/internal/pipe/brew/testdata/TestFullPipe/default_gitlab.rb.golden @@ -6,6 +6,12 @@ class DefaultGitlab < Formula desc "A run pipe test formula and FOO=foo_is_bar" homepage "https://gitlab.com/goreleaser" version "1.0.1" + + depends_on "zsh" => :optional + depends_on "bash" + + conflicts_with "gtk+" + conflicts_with "qt" depends_on :macos on_macos do @@ -27,12 +33,6 @@ class DefaultGitlab < Formula end end - depends_on "zsh" => :optional - depends_on "bash" - - conflicts_with "gtk+" - conflicts_with "qt" - def post_install system "echo" system "touch" "/tmp/hi" diff --git a/internal/pipe/brew/testdata/TestFullPipe/valid_tap_templates.rb.golden b/internal/pipe/brew/testdata/TestFullPipe/valid_tap_templates.rb.golden index 69dd9e0f8ce..38093895626 100644 --- a/internal/pipe/brew/testdata/TestFullPipe/valid_tap_templates.rb.golden +++ b/internal/pipe/brew/testdata/TestFullPipe/valid_tap_templates.rb.golden @@ -6,6 +6,12 @@ class ValidTapTemplates < Formula desc "A run pipe test formula and FOO=templated" homepage "" version "1.0.1" + + depends_on "zsh" => :optional + depends_on "bash" + + conflicts_with "gtk+" + conflicts_with "qt" depends_on :macos on_macos do @@ -27,12 +33,6 @@ class ValidTapTemplates < Formula end end - depends_on "zsh" => :optional - depends_on "bash" - - conflicts_with "gtk+" - conflicts_with "qt" - def post_install system "echo" system "touch" "/tmp/hi" diff --git a/internal/pipe/brew/testdata/TestRunPipeForMultipleArmVersions/multiple_armv5.rb.golden b/internal/pipe/brew/testdata/TestRunPipeForMultipleArmVersions/multiple_armv5.rb.golden index fe5df905a18..ec924dd7689 100644 --- a/internal/pipe/brew/testdata/TestRunPipeForMultipleArmVersions/multiple_armv5.rb.golden +++ b/internal/pipe/brew/testdata/TestRunPipeForMultipleArmVersions/multiple_armv5.rb.golden @@ -7,6 +7,12 @@ class MultipleArmv5 < Formula homepage "https://github.com/goreleaser" version "1.0.1" + depends_on "zsh" + depends_on "bash" => :recommended + + conflicts_with "gtk+" + conflicts_with "qt" + on_macos do url "https://dummyhost/download/v1.0.1/bin.tar.gz" sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" @@ -45,12 +51,6 @@ class MultipleArmv5 < Formula end end - depends_on "zsh" - depends_on "bash" => :recommended - - conflicts_with "gtk+" - conflicts_with "qt" - def caveats; <<~EOS don't do this multiple_armv5 EOS diff --git a/internal/pipe/brew/testdata/TestRunPipeForMultipleArmVersions/multiple_armv6.rb.golden b/internal/pipe/brew/testdata/TestRunPipeForMultipleArmVersions/multiple_armv6.rb.golden index 92bcf99d70f..bfe1191cbdb 100644 --- a/internal/pipe/brew/testdata/TestRunPipeForMultipleArmVersions/multiple_armv6.rb.golden +++ b/internal/pipe/brew/testdata/TestRunPipeForMultipleArmVersions/multiple_armv6.rb.golden @@ -7,6 +7,12 @@ class MultipleArmv6 < Formula homepage "https://github.com/goreleaser" version "1.0.1" + depends_on "zsh" + depends_on "bash" => :recommended + + conflicts_with "gtk+" + conflicts_with "qt" + on_macos do url "https://dummyhost/download/v1.0.1/bin.tar.gz" sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" @@ -45,12 +51,6 @@ class MultipleArmv6 < Formula end end - depends_on "zsh" - depends_on "bash" => :recommended - - conflicts_with "gtk+" - conflicts_with "qt" - def caveats; <<~EOS don't do this multiple_armv6 EOS diff --git a/internal/pipe/brew/testdata/TestRunPipeForMultipleArmVersions/multiple_armv7.rb.golden b/internal/pipe/brew/testdata/TestRunPipeForMultipleArmVersions/multiple_armv7.rb.golden index cbf3f0c5031..aeea743ec52 100644 --- a/internal/pipe/brew/testdata/TestRunPipeForMultipleArmVersions/multiple_armv7.rb.golden +++ b/internal/pipe/brew/testdata/TestRunPipeForMultipleArmVersions/multiple_armv7.rb.golden @@ -7,6 +7,12 @@ class MultipleArmv7 < Formula homepage "https://github.com/goreleaser" version "1.0.1" + depends_on "zsh" + depends_on "bash" => :recommended + + conflicts_with "gtk+" + conflicts_with "qt" + on_macos do url "https://dummyhost/download/v1.0.1/bin.tar.gz" sha256 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" @@ -45,12 +51,6 @@ class MultipleArmv7 < Formula end end - depends_on "zsh" - depends_on "bash" => :recommended - - conflicts_with "gtk+" - conflicts_with "qt" - def caveats; <<~EOS don't do this multiple_armv7 EOS