44 lines
1.4 KiB
Ruby
44 lines
1.4 KiB
Ruby
class Gomplate < Formula
|
|
desc "Command-line Golang template processor"
|
|
homepage "https://gomplate.hairyhenderson.ca/"
|
|
url "https://github.com/hairyhenderson/gomplate/archive/v3.4.0.tar.gz"
|
|
sha256 "8e7e496a0829fd987a68575968926f24df4411a2ff87842e25ee15a0995e7590"
|
|
head "https://github.com/hairyhenderson/gomplate.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "55b0c35116cdc27e900d4c8b805a2373511351ab2120498ecac2422ba3df29f0" => :mojave
|
|
sha256 "f76e8871fbe176b088b9256d3438199f1a52b805d9881e8514f8380d403bb07a" => :high_sierra
|
|
sha256 "762cb52ff28ae881f94cde760fd059a4370e7e0eb7dfeb941b197d7c8eff61bc" => :sierra
|
|
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
|