113 lines
3.5 KiB
Ruby
113 lines
3.5 KiB
Ruby
require "language/go"
|
|
|
|
class Caddy < Formula
|
|
desc "Alternative general-purpose HTTP/2 web server"
|
|
homepage "https://caddyserver.com/"
|
|
url "https://github.com/mholt/caddy/archive/v0.8.1.tar.gz"
|
|
sha256 "360e49087c084ac61498f6cb6acf8f4c2480656f7635672265156136b6ae7474"
|
|
head "https://github.com/mholt/caddy.git"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
sha256 "8e0566facfab8e80e493fbfc1a15e374e58ff40c588efafc3b939e180e1c3395" => :el_capitan
|
|
sha256 "a732b1135987289bd4ddd93f558960852b04ae289fe2890bc4864f1399d4e2e8" => :yosemite
|
|
sha256 "43e2c583ce80d05b36746550b7de29767fd56f53d3555ec7ff4d2da75b4d7f53" => :mavericks
|
|
end
|
|
|
|
depends_on "go" => :build
|
|
|
|
go_resource "github.com/BurntSushi/toml" do
|
|
url "https://github.com/BurntSushi/toml.git",
|
|
:revision => "5c4df71dfe9ac89ef6287afc05e4c1b16ae65a1e"
|
|
end
|
|
|
|
go_resource "github.com/dustin/go-humanize" do
|
|
url "https://github.com/dustin/go-humanize.git",
|
|
:revision => "8929fe90cee4b2cb9deb468b51fb34eba64d1bf0"
|
|
end
|
|
|
|
go_resource "github.com/flynn/go-shlex" do
|
|
url "https://github.com/flynn/go-shlex.git",
|
|
:revision => "3f9db97f856818214da2e1057f8ad84803971cff"
|
|
end
|
|
|
|
go_resource "github.com/gorilla/websocket" do
|
|
url "https://github.com/gorilla/websocket.git",
|
|
:revision => "3986be78bf859e01f01af631ad76da5b269d270c"
|
|
end
|
|
|
|
go_resource "github.com/hashicorp/go-syslog" do
|
|
url "https://github.com/hashicorp/go-syslog.git",
|
|
:revision => "42a2b573b664dbf281bd48c3cc12c086b17a39ba"
|
|
end
|
|
|
|
go_resource "github.com/jimstudt/http-authentication" do
|
|
url "https://github.com/jimstudt/http-authentication.git",
|
|
:revision => "3eca13d6893afd7ecabe15f4445f5d2872a1b012"
|
|
end
|
|
|
|
go_resource "github.com/russross/blackfriday" do
|
|
url "https://github.com/russross/blackfriday.git",
|
|
:revision => "c8875c0ed47e07b063c3628e2e4d4c9826721795"
|
|
end
|
|
|
|
go_resource "github.com/shurcooL/sanitized_anchor_name" do
|
|
url "https://github.com/shurcooL/sanitized_anchor_name.git",
|
|
:revision => "10ef21a441db47d8b13ebcc5fd2310f636973c77"
|
|
end
|
|
|
|
go_resource "github.com/square/go-jose" do
|
|
url "https://github.com/square/go-jose.git",
|
|
:revision => "37934a899dd03635373fd1e143936d32cfe48d31"
|
|
end
|
|
|
|
go_resource "github.com/xenolf/lego" do
|
|
url "https://github.com/xenolf/lego.git",
|
|
:revision => "db3a956d52bf23cc5201fe98bc9c9787d3b32c2d"
|
|
end
|
|
|
|
go_resource "golang.org/x/crypto" do
|
|
url "https://go.googlesource.com/crypto.git",
|
|
:revision => "3760e016850398b85094c4c99e955b8c3dea5711"
|
|
end
|
|
|
|
go_resource "golang.org/x/net" do
|
|
url "https://go.googlesource.com/net.git",
|
|
:revision => "72aa00c6241a8013dc9b040abb45f57edbe73945"
|
|
end
|
|
|
|
go_resource "gopkg.in/natefinch/lumberjack.v2" do
|
|
url "https://gopkg.in/natefinch/lumberjack.v2.git",
|
|
:revision => "600ceb4523e5b7ff745f91083c8a023c2bf73af5"
|
|
end
|
|
|
|
go_resource "gopkg.in/yaml.v2" do
|
|
url "https://gopkg.in/yaml.v2.git",
|
|
:revision => "f7716cbe52baa25d2e9b0d0da546fcf909fc16b4"
|
|
end
|
|
|
|
def install
|
|
ENV["GOPATH"] = buildpath
|
|
ENV["GOOS"] = "darwin"
|
|
ENV["GOARCH"] = MacOS.prefer_64_bit? ? "amd64" : "386"
|
|
|
|
mkdir_p buildpath/"src/github.com/mholt/"
|
|
ln_s buildpath, buildpath/"src/github.com/mholt/caddy"
|
|
Language::Go.stage_deps resources, buildpath/"src"
|
|
|
|
system "go", "build", "-o", bin/"caddy"
|
|
doc.install %w[README.md LICENSE.txt]
|
|
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
|