class Gitversion < Formula desc "Easy semantic versioning for projects using Git" homepage "https://github.com/GitTools/GitVersion" url "https://github.com/GitTools/GitVersion/releases/download/5.1.3/gitversion-osx-5.1.3.tar.gz" sha256 "ae885c7eaf58f8af2350c4a8b258095bd6059f606d2b3bb6d6c9420b404f8545" bottle :unneeded def install libexec.install Dir["*"] (bin/"gitversion").write <<~EOS #!/bin/sh exec "#{libexec}/GitVersion" "$@" EOS end test do # Circumvent GitVersion's build server detection scheme: ENV["JENKINS_URL"] = nil (testpath/"test.txt").write("test") system "git", "init" system "git", "add", "test.txt" system "git", "commit", "-q", "--author='Test '", "--message='Test'" assert_match '"FullSemVer":"0.1.0+0"', shell_output("#{bin}/gitversion -output json") end end