homebrew-core/Formula/caddy.rb

72 lines
2.2 KiB
Ruby
Raw Normal View History

require "language/go"
class Caddy < Formula
homepage "https://caddyserver.com/"
url "https://github.com/mholt/caddy/archive/v0.6.0.tar.gz"
sha256 "919023cd91b6ab94fcde08fc30620b10f90eaaa95ab8b9f3ff7e06c0e9b7f301"
desc "Caddy is an alternative HTTP/2 web server that is easy to configure and use"
depends_on "go" => :build
head do
url "https://github.com/mholt/caddy.git"
go_resource "gopkg.in/yaml.v2" do
url "https://gopkg.in/yaml.v2.git"
end
go_resource "github.com/BurntSushi/toml" do
url "https://github.com/BurntSushi/toml.git", :revision => "056c9bc7be7190eaa7715723883caffa5f8fa3e4"
end
end
go_resource "golang.org/x/net" do
url "https://go.googlesource.com/net.git", :revision => "e0403b4e005737430c05a57aac078479844f919c"
end
go_resource "github.com/bradfitz/http2" do
url "https://github.com/bradfitz/http2.git", :revision => "f8202bc903bda493ebba4aa54922d78430c2c42f"
end
go_resource "github.com/dustin/go-humanize" do
url "https://github.com/dustin/go-humanize.git", :revision => "00897f070f09f194c26d65afae734ba4c32404e8"
end
go_resource "github.com/flynn/go-shlex" do
url "https://github.com/flynn/go-shlex.git", :revision => "70644ac2a65dbf1691ce00c209d185163a14edc6"
end
go_resource "github.com/russross/blackfriday" do
url "https://github.com/russross/blackfriday.git", :revision => "4bed88b4fd00fbb66b49b0f38ed3dd0b902ab515"
end
go_resource "github.com/shurcooL/sanitized_anchor_name" do
url "https://github.com/shurcooL/sanitized_anchor_name.git", :revision => "8e87604bec3c645a4eeaee97dfec9f25811ff20d"
end
def install
mkdir_p buildpath/"src/github.com/mholt/"
ln_s buildpath, buildpath/"src/github.com/mholt/caddy"
ENV["GOPATH"] = buildpath
ENV["GOOS"] = "darwin"
ENV["GOARCH"] = MacOS.prefer_64_bit? ? "amd64" : "386"
Language::Go.stage_deps resources, buildpath/"src"
system "go", "build", "-o", "caddy"
bin.install "caddy"
doc.install %w[README.md LICENSE.md]
end
test do
begin
io = IO.popen("#{bin}/caddy")
sleep 2
ensure
Process.kill("SIGINT", io.pid)
Process.wait(io.pid)
end
io.read =~ /0\.0\.0\.0:2015/
end
end