homebrew-core/Formula/gitversion.rb
2019-11-07 20:01:46 -05:00

27 lines
875 B
Ruby

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.2/gitversion-osx-5.1.2.tar.gz"
sha256 "eb24c6b798a5cbfa427ab1154a98d77180aca53403cb5a8801165167601d1eed"
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 <test@example.com>'", "--message='Test'"
assert_match '"FullSemVer":"0.1.0+0"', shell_output("#{bin}/gitversion -output json")
end
end