2015-05-12 20:49:53 +00:00
|
|
|
require "language/go"
|
|
|
|
|
|
|
|
class Caddy < Formula
|
2015-06-02 15:53:34 +00:00
|
|
|
desc "Alternative general-purpose HTTP/2 web server"
|
2015-08-09 03:34:15 +00:00
|
|
|
homepage "https://caddyserver.com/"
|
2015-12-15 02:48:28 +00:00
|
|
|
url "https://github.com/mholt/caddy/archive/v0.8.0.tar.gz"
|
|
|
|
sha256 "c7650e8772b8b19cbe5aca1c51898c053c9df397237e54f671cee8780f21d741"
|
2015-08-09 03:34:15 +00:00
|
|
|
head "https://github.com/mholt/caddy.git"
|
2015-05-12 20:49:53 +00:00
|
|
|
|
2015-05-31 03:05:23 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2015-08-09 03:45:51 +00:00
|
|
|
sha256 "bb91e6fdf8214ced695a79d8a4b1c1bf30612f24cb46119f8eaf9479edbe9da8" => :yosemite
|
|
|
|
sha256 "638006bfc8db6721e692be399d9250dcc01194e43765e2ef5aeed7c4f00c3f89" => :mavericks
|
|
|
|
sha256 "6a89643de7a9f61435e9a27838f095d0fa1616ef11b9fcfafb0d94980921e763" => :mountain_lion
|
2015-05-31 03:05:23 +00:00
|
|
|
end
|
|
|
|
|
2015-05-12 20:49:53 +00:00
|
|
|
depends_on "go" => :build
|
|
|
|
|
2015-08-09 03:34:15 +00:00
|
|
|
go_resource "gopkg.in/yaml.v2" do
|
|
|
|
url "https://github.com/go-yaml/yaml.git",
|
|
|
|
:branch => "v2",
|
|
|
|
:revision => "bec87e4332aede01fb63a4ab299d8af28480cd96"
|
|
|
|
end
|
2015-05-12 20:49:53 +00:00
|
|
|
|
2015-08-09 03:34:15 +00:00
|
|
|
go_resource "github.com/BurntSushi/toml" do
|
|
|
|
url "https://github.com/BurntSushi/toml.git", :revision => "056c9bc7be7190eaa7715723883caffa5f8fa3e4"
|
2015-05-12 20:49:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "golang.org/x/net" do
|
2015-12-15 02:48:28 +00:00
|
|
|
url "https://go.googlesource.com/net.git", :revision => "943b8c241accc9aa2b2a91735b28aea7f26765cb"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "golang.org/x/crypto" do
|
|
|
|
url "https://go.googlesource.com/crypto.git", :revision => "7b85b097bf7527677d54d3220065e966a0e3b613"
|
2015-05-12 20:49:53 +00:00
|
|
|
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
|
2015-08-09 03:34:15 +00:00
|
|
|
url "https://github.com/dustin/go-humanize.git", :revision => "c128122e0b9b93799aef8181a537e5d8fd7081d6"
|
2015-05-12 20:49:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/flynn/go-shlex" do
|
2015-08-09 03:34:15 +00:00
|
|
|
url "https://github.com/flynn/go-shlex.git", :revision => "3f9db97f856818214da2e1057f8ad84803971cff"
|
2015-05-12 20:49:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/russross/blackfriday" do
|
2015-08-09 03:34:15 +00:00
|
|
|
url "https://github.com/russross/blackfriday.git", :revision => "8cec3a854e68dba10faabbe31c089abf4a3e57a6"
|
2015-05-12 20:49:53 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/shurcooL/sanitized_anchor_name" do
|
2015-08-09 03:34:15 +00:00
|
|
|
url "https://github.com/shurcooL/sanitized_anchor_name.git", :revision => "11a20b799bf22a02808c862eb6ca09f7fb38f84a"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/hashicorp/go-syslog" do
|
|
|
|
url "https://github.com/hashicorp/go-syslog.git", :revision => "42a2b573b664dbf281bd48c3cc12c086b17a39ba"
|
2015-05-12 20:49:53 +00:00
|
|
|
end
|
|
|
|
|
2015-12-15 02:48:28 +00:00
|
|
|
go_resource "github.com/gorilla/websocket" do
|
|
|
|
url "https://github.com/gorilla/websocket.git", :revision => "844dd6d40e1a9215ef4c8a204bfc839fcf5dd5dd"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/jimstudt/http-authentication" do
|
|
|
|
url "https://github.com/jimstudt/http-authentication.git", :revision => "3eca13d6893afd7ecabe15f4445f5d2872a1b012"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/xenolf/lego" do
|
|
|
|
url "https://github.com/xenolf/lego.git", :revision => "bf740fa2cafb7d6deb0911792a13f37ef5995a03"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "gopkg.in/natefinch/lumberjack.v2" do
|
|
|
|
url "https://github.com/natefinch/lumberjack.git", :revision => "600ceb4523e5b7ff745f91083c8a023c2bf73af5"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/square/go-jose" do
|
|
|
|
url "https://github.com/square/go-jose.git", :revision => "37934a899dd03635373fd1e143936d32cfe48d31"
|
|
|
|
end
|
|
|
|
|
2015-05-12 20:49:53 +00:00
|
|
|
def install
|
|
|
|
ENV["GOPATH"] = buildpath
|
|
|
|
ENV["GOOS"] = "darwin"
|
|
|
|
ENV["GOARCH"] = MacOS.prefer_64_bit? ? "amd64" : "386"
|
2015-08-09 03:34:15 +00:00
|
|
|
|
|
|
|
mkdir_p buildpath/"src/github.com/mholt/"
|
|
|
|
ln_s buildpath, buildpath/"src/github.com/mholt/caddy"
|
2015-05-12 20:49:53 +00:00
|
|
|
Language::Go.stage_deps resources, buildpath/"src"
|
|
|
|
|
2015-08-09 03:34:15 +00:00
|
|
|
system "go", "build", "-o", bin/"caddy"
|
|
|
|
doc.install %w[README.md LICENSE.txt]
|
2015-05-12 20:49:53 +00:00
|
|
|
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
|