class Gomplate < Formula desc "Command-line Golang template processor" homepage "https://gomplate.hairyhenderson.ca/" url "https://github.com/hairyhenderson/gomplate/archive/v3.2.0.tar.gz" sha256 "52663592a5fd1a67a8c48ebd434860e1930fe3b9cab2c740bef7629177f932ba" head "https://github.com/hairyhenderson/gomplate.git" bottle do cellar :any_skip_relocation sha256 "2ea33ca97932b9d1f6a18e5ed460056ed83d31ba9e189be2b97205df52355343" => :mojave sha256 "4a52b61754bc9458ec2504051996c7046d5f571bab9395ae11b5adc6eab3b285" => :high_sierra sha256 "a251d5860d01d850ffde0f7e86255553abfb1f7836a946803bd0b2c8d5d06edb" => :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