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"
|
2016-02-27 16:56:04 +00:00
|
|
|
url "https://github.com/cortesi/devd/archive/v0.4.tar.gz"
|
|
|
|
sha256 "8cf15ece9b707658ef4825e4c031ff8dd54b8ea7c4ff6a9b07bb68b400d15253"
|
2016-03-17 03:44:19 +00:00
|
|
|
revision 1
|
2015-11-13 23:40:49 +00:00
|
|
|
|
2015-11-16 09:30:01 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any_skip_relocation
|
2016-03-17 04:42:01 +00:00
|
|
|
sha256 "ee919bf9b216b5cf1fad2de7627eea0883e0b392f891a19ae8f5ea8818bd65ee" => :el_capitan
|
|
|
|
sha256 "33f18c922401b450b6980ca514aa40e55ad139971ad5d43be949a7364efda0f5" => :yosemite
|
|
|
|
sha256 "38ed72f264983c9f12927744d26003159778e7a757b2b7fe7e5821da66927afd" => :mavericks
|
2015-11-16 09:30:01 +00:00
|
|
|
end
|
|
|
|
|
2015-11-13 23:40:49 +00:00
|
|
|
depends_on "go" => :build
|
|
|
|
|
|
|
|
go_resource "github.com/GeertJohan/go.rice" do
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://github.com/GeertJohan/go.rice.git",
|
2016-02-27 16:56:04 +00:00
|
|
|
:revision => "0f3f5fde32fd1f755632a3d31ba2ec6d449e387b"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# go.rice dependencies
|
|
|
|
go_resource "github.com/daaku/go.zipexe" do
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://github.com/daaku/go.zipexe.git",
|
|
|
|
:revision => "a5fe2436ffcb3236e175e5149162b41cd28bd27d"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/GeertJohan/go.incremental" do
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://github.com/GeertJohan/go.incremental.git",
|
|
|
|
:revision => "92fd0ce4a694213e8b3dfd2d39b16e51d26d0fbf"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/akavel/rsrc" do
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://github.com/akavel/rsrc.git",
|
|
|
|
:revision => "ba14da1f827188454a4591717fff29999010887f"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/jessevdk/go-flags" do
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://github.com/jessevdk/go-flags.git",
|
2016-02-27 16:56:04 +00:00
|
|
|
:revision => "6b9493b3cb60367edd942144879646604089e3f7"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# devd dependencies
|
2016-02-27 16:56:04 +00:00
|
|
|
go_resource "github.com/kardianos/osext" do
|
|
|
|
url "https://github.com/kardianos/osext.git",
|
|
|
|
:revision => "29ae4ffbc9a6fe9fb2bc5029050ce6996ea1d3bc"
|
|
|
|
end
|
|
|
|
|
2015-11-13 23:40:49 +00:00
|
|
|
go_resource "github.com/bmatcuk/doublestar" do
|
2016-02-27 16:56:04 +00:00
|
|
|
# v1.0.3
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://github.com/bmatcuk/doublestar.git",
|
2016-02-27 16:56:04 +00:00
|
|
|
:revision => "ec3b4af762f792cb93bf2518ff9ac408dbdc2b4e"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/dustin/go-humanize" do
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://github.com/dustin/go-humanize.git",
|
2016-02-27 16:56:04 +00:00
|
|
|
:revision => "8929fe90cee4b2cb9deb468b51fb34eba64d1bf0"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/fatih/color" do
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://github.com/fatih/color.git",
|
2016-02-27 16:56:04 +00:00
|
|
|
:revision => "4f7bcef27eec7925456d0c30c5e7b0408b3339be"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/goji/httpauth" do
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://github.com/goji/httpauth.git",
|
2016-02-27 16:56:04 +00:00
|
|
|
:revision => "fc389c3003535723411032f2e9300889389e30fa"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/gorilla/websocket" do
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://github.com/gorilla/websocket.git",
|
2016-02-27 16:56:04 +00:00
|
|
|
:revision => "5c91b59efa232fa9a87b705d54101832c498a172"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/juju/ratelimit" do
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://github.com/juju/ratelimit.git",
|
2016-02-27 16:56:04 +00:00
|
|
|
:revision => "77ed1c8a01217656d2080ad51981f6e99adaa177"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/mitchellh/go-homedir" do
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://github.com/mitchellh/go-homedir.git",
|
|
|
|
:revision => "d682a8f0cf139663a984ff12528da460ca963de9"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/rjeczalik/notify" do
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://github.com/rjeczalik/notify.git",
|
2016-03-17 03:44:19 +00:00
|
|
|
:revision => "5dd6205716539662f8f14ab513552b41eab69d5d"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/toqueteos/webbrowser" do
|
|
|
|
# v1.0
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://github.com/toqueteos/webbrowser.git",
|
|
|
|
:revision => "21fc9f95c83442fd164094666f7cb4f9fdd56cd6"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/alecthomas/template" do
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://github.com/alecthomas/template.git",
|
2016-02-27 16:56:04 +00:00
|
|
|
:revision => "14fd436dd20c3cc65242a9f396b61bfc8a3926fc"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/alecthomas/units" do
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://github.com/alecthomas/units.git",
|
|
|
|
:revision => "2efee857e7cfd4f3d0138cc3cbb1b4966962b93a"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "golang.org/x/crypto" do
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://go.googlesource.com/crypto.git",
|
2016-02-27 16:56:04 +00:00
|
|
|
:revision => "5dc8cb4b8a8eb076cbb5a06bc3b8682c15bdbbd3"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "golang.org/x/net" do
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://go.googlesource.com/net.git",
|
2016-02-27 16:56:04 +00:00
|
|
|
:revision => "6acef71eb69611914f7a30939ea9f6e194c78172"
|
2015-11-13 23:40:49 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "gopkg.in/alecthomas/kingpin.v2" do
|
2016-02-27 16:56:04 +00:00
|
|
|
# v2.1.11
|
2016-01-15 04:28:56 +00:00
|
|
|
url "https://github.com/alecthomas/kingpin.git",
|
2016-02-27 16:56:04 +00:00
|
|
|
:revision => "8cccfa8eb2e3183254457fb1749b2667fbc364c7"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/cortesi/modd" do
|
|
|
|
# v0.2
|
|
|
|
url "https://github.com/cortesi/modd.git",
|
|
|
|
:revision => "459621750bfdbd0a80d706db8092d4b3a34a55d6"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/cortesi/termlog" do
|
|
|
|
url "https://github.com/cortesi/termlog.git",
|
|
|
|
:revision => "898fe0decfa430637283eebf1fd19d4f6ce0a531"
|
2015-11-13 23:40:49 +00:00
|
|
|
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
|