2015-11-13 23:40:49 +00:00
|
|
|
require "language/go"
|
|
|
|
|
|
|
|
class Devd < Formula
|
|
|
|
desc "Local webserver for developers"
|
|
|
|
homepage "https://github.com/cortesi/devd"
|
|
|
|
url "https://github.com/cortesi/devd/archive/v0.3.tar.gz"
|
|
|
|
sha256 "e806421a4de6572eb3196b215a86a3b72bcd0f5a12956224d191e47663f9c4ab"
|
|
|
|
|
2015-11-16 09:30:01 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any_skip_relocation
|
|
|
|
sha256 "24300e18e3291b229c950f2e9712df430e09e15fd57895041d3e29fa26086b39" => :el_capitan
|
|
|
|
sha256 "249f1d803e732f1a1a91973d610f56ba129338b52831a11cfe08e1d519ac0116" => :yosemite
|
|
|
|
sha256 "613460e6d2368b1c35930eb78d24656a906db92d6a0ed2ad6e8b5764e42d7806" => :mavericks
|
|
|
|
end
|
|
|
|
|
2015-11-13 23:40:49 +00:00
|
|
|
depends_on "go" => :build
|
|
|
|
|
|
|
|
go_resource "github.com/GeertJohan/go.rice" do
|
|
|
|
url "https://github.com/GeertJohan/go.rice.git", :revision => "ada95a01c963696fb73320ee662195af68be81ae"
|
|
|
|
end
|
|
|
|
|
|
|
|
# go.rice dependencies
|
|
|
|
go_resource "github.com/daaku/go.zipexe" do
|
|
|
|
url "https://github.com/daaku/go.zipexe.git", :revision => "a5fe2436ffcb3236e175e5149162b41cd28bd27d"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/kardianos/osext" do
|
|
|
|
url "https://github.com/kardianos/osext.git", :revision => "6e7f843663477789fac7c02def0d0909e969b4e5"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/GeertJohan/go.incremental" do
|
|
|
|
url "https://github.com/GeertJohan/go.incremental.git", :revision => "92fd0ce4a694213e8b3dfd2d39b16e51d26d0fbf"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/akavel/rsrc" do
|
|
|
|
url "https://github.com/akavel/rsrc.git", :revision => "ba14da1f827188454a4591717fff29999010887f"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/jessevdk/go-flags" do
|
|
|
|
url "https://github.com/jessevdk/go-flags.git", :revision => "fc93116606d0a71d7e9de0ad5734fdb4b8eae834"
|
|
|
|
end
|
|
|
|
|
|
|
|
# devd dependencies
|
|
|
|
go_resource "github.com/bmatcuk/doublestar" do
|
|
|
|
# v1.0.1
|
|
|
|
url "https://github.com/bmatcuk/doublestar.git", :revision => "4f612bd6c10e2ef68e2ea50aabc50c3681bbac86"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/dustin/go-humanize" do
|
|
|
|
url "https://github.com/dustin/go-humanize.git", :revision => "64dbdae0d393b7d71480a6dace78456396b55286"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/fatih/color" do
|
|
|
|
url "https://github.com/fatih/color.git", :revision => "9aae6aaa22315390f03959adca2c4d395b02fcef"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/goji/httpauth" do
|
|
|
|
url "https://github.com/goji/httpauth.git", :revision => "c1b2bcd8769bd15cc56751223fd4b9f45ca987ca"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/gorilla/websocket" do
|
|
|
|
url "https://github.com/gorilla/websocket.git", :revision => "361d4c0ffd78338ebe0a9e6320cdbe115d7dc026"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/juju/ratelimit" do
|
|
|
|
url "https://github.com/juju/ratelimit.git", :revision => "772f5c38e468398c4511514f4f6aa9a4185bc0a0"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/mitchellh/go-homedir" do
|
|
|
|
url "https://github.com/mitchellh/go-homedir.git", :revision => "d682a8f0cf139663a984ff12528da460ca963de9"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/rjeczalik/notify" do
|
|
|
|
url "https://github.com/rjeczalik/notify.git", :revision => "1869adb163fffce8fb5b8755379d1042cdb4c4f8"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/toqueteos/webbrowser" do
|
|
|
|
# v1.0
|
|
|
|
url "https://github.com/toqueteos/webbrowser.git", :revision => "21fc9f95c83442fd164094666f7cb4f9fdd56cd6"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/alecthomas/template" do
|
|
|
|
url "https://github.com/alecthomas/template.git", :revision => "b867cc6ab45cece8143cfcc6fc9c77cf3f2c23c0"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/alecthomas/units" do
|
|
|
|
url "https://github.com/alecthomas/units.git", :revision => "2efee857e7cfd4f3d0138cc3cbb1b4966962b93a"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/mattn/go-colorable" do
|
|
|
|
url "https://github.com/mattn/go-colorable.git", :revision => "51a7e7a8b1665b25ca173debdc8d52d493348f15"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/mattn/go-isatty" do
|
|
|
|
url "https://github.com/mattn/go-isatty.git", :revision => "d6aaa2f596ae91a0a58d8e7f2c79670991468e4f"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "golang.org/x/crypto" do
|
|
|
|
url "https://go.googlesource.com/crypto.git", :revision => "575fdbe86e5dd89229707ebec0575ce7d088a4a6"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "golang.org/x/net" do
|
|
|
|
url "https://go.googlesource.com/net.git", :revision => "c764672d0ee39ffd83cfcb375804d3181302b62b"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "gopkg.in/alecthomas/kingpin.v2" do
|
|
|
|
# v2.4.1
|
|
|
|
url "https://github.com/alecthomas/kingpin.git", :revision => "95529ad11b3c862a5b828a2142b9e50db579cf2c"
|
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
|
|
|
ENV["GOOS"] = "darwin"
|
|
|
|
ENV["GOARCH"] = MacOS.prefer_64_bit? ? "amd64" : "386"
|
|
|
|
ENV["GOPATH"] = buildpath
|
|
|
|
|
|
|
|
mkdir_p buildpath/"src/github.com/cortesi/"
|
|
|
|
ln_sf buildpath, buildpath/"src/github.com/cortesi/devd"
|
|
|
|
Language::Go.stage_deps resources, buildpath/"src"
|
|
|
|
|
|
|
|
system "go", "install", "github.com/GeertJohan/go.rice/rice"
|
|
|
|
|
|
|
|
ENV.prepend_path "PATH", buildpath/"bin"
|
|
|
|
|
|
|
|
# NOTE: versions after v0.3 have improved build script, thus
|
|
|
|
# it would be simplier to call in future
|
|
|
|
# system "./build", "single"
|
|
|
|
# meanwhile, we do compilation like this:
|
|
|
|
system "rice", "embed-go"
|
|
|
|
cd "#{buildpath}/livereload" do
|
|
|
|
system "rice", "embed-go"
|
|
|
|
end
|
|
|
|
system "go", "build", "-o", "#{bin}/devd", "./cmd/devd"
|
|
|
|
doc.install "README.md"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
begin
|
|
|
|
io = IO.popen("#{bin}/devd #{testpath}")
|
|
|
|
sleep 2
|
|
|
|
ensure
|
|
|
|
Process.kill("SIGINT", io.pid)
|
|
|
|
Process.wait(io.pid)
|
|
|
|
end
|
|
|
|
|
|
|
|
assert_match "Listening on http://devd.io", io.read
|
|
|
|
end
|
|
|
|
end
|