diff --git a/Formula/mkcert.rb b/Formula/mkcert.rb new file mode 100644 index 0000000000..f4c0a300be --- /dev/null +++ b/Formula/mkcert.rb @@ -0,0 +1,29 @@ +class Mkcert < Formula + desc "Simple tool to make locally trusted development certificates" + homepage "https://github.com/FiloSottile/mkcert" + url "https://github.com/FiloSottile/mkcert/archive/v0.9.0.tar.gz" + sha256 "cae5871f83cb4c43e0475b69cf6325e5f731a8597e1557a4e9f042510f93d45b" + + depends_on "go" => :build + + def install + ENV["GOPATH"] = buildpath + (buildpath/"src/github.com/FiloSottile/mkcert").install buildpath.children + + cd "src/github.com/FiloSottile/mkcert" do + system "go", "build", "-o", bin/"mkcert" + prefix.install_metafiles + end + end + + test do + ENV["CAROOT"] = testpath + system bin/"mkcert", "brew.test" + assert_predicate testpath/"brew.test.pem", :exist? + assert_predicate testpath/"brew.test-key.pem", :exist? + output = (testpath/"brew.test.pem").read + assert_match "-----BEGIN CERTIFICATE-----", output + output = (testpath/"brew.test-key.pem").read + assert_match "-----BEGIN PRIVATE KEY-----", output + end +end