homebrew-core/Formula/gomplate.rb
2018-08-22 22:15:09 +02:00

45 lines
1.5 KiB
Ruby

class Gomplate < Formula
desc "Command-line Golang template processor"
homepage "https://gomplate.hairyhenderson.ca/"
url "https://github.com/hairyhenderson/gomplate/archive/v2.7.0.tar.gz"
sha256 "c9be7f326cba2232bddec9c37ca77f111539e8157fc2cc0907c5815cb86e5dd9"
head "https://github.com/hairyhenderson/gomplate.git"
bottle do
cellar :any_skip_relocation
sha256 "96d5bc0515dda726c5424e1f95e5375d8b7a55ff5d64022ea73b77a86922244d" => :mojave
sha256 "219d7483e76bc78ceae0ad1372653dd3259fadd7992ed3e31126836fc955dd52" => :high_sierra
sha256 "b7d90835fcdd42ee7579927bf2724d891b25d0f6961156dd387200c62aa146e8" => :sierra
sha256 "a088b94fc627118ebbfd30b334a8505414cef1863b9fbc37c59dccc1c6dcaeed" => :el_capitan
end
depends_on "go" => :build
depends_on "upx" => :build
def install
ENV["GOPATH"] = buildpath
(buildpath/"src/github.com/hairyhenderson/gomplate").install buildpath.children
cd "src/github.com/hairyhenderson/gomplate" do
system "make", "compress", "VERSION=#{version}"
bin.install "bin/gomplate-slim" => "gomplate"
prefix.install_metafiles
end
end
test do
output = shell_output("#{bin}/gomplate --version")
assert_equal "gomplate version #{version}", output.chomp
test_template = <<~EOS
{{ range ("foo:bar:baz" | strings.SplitN ":" 2) }}{{.}}
{{end}}
EOS
expected = <<~EOS
foo
bar:baz
EOS
assert_match expected, pipe_output("#{bin}/gomplate", test_template, 0)
end
end