2014-10-13 05:29:42 +00:00
|
|
|
require "language/go"
|
|
|
|
|
|
|
|
class Pup < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Parse HTML at the command-line"
|
2014-10-13 05:29:42 +00:00
|
|
|
homepage "https://github.com/EricChiang/pup"
|
2015-05-05 22:55:39 +00:00
|
|
|
url "https://github.com/ericchiang/pup/archive/v0.3.9.tar.gz"
|
|
|
|
sha256 "5e59805edf84d73b2b4c58fe5aeb9a12fc70c028b4aaf58ded6b91ff418b0dda"
|
2014-10-13 05:29:42 +00:00
|
|
|
|
|
|
|
head "https://github.com/EricChiang/pup.git"
|
|
|
|
|
2014-10-13 15:15:07 +00:00
|
|
|
bottle do
|
2015-09-24 19:47:43 +00:00
|
|
|
cellar :any_skip_relocation
|
|
|
|
sha256 "e3766f1c194ece7e6eea245627c6ca2ae83d7a7cd33dfaf61da53ad85577dfd6" => :el_capitan
|
2015-05-06 05:31:45 +00:00
|
|
|
sha256 "0c3f2f89d57313b4d5d90a73c39e5187470e7dd9f35a0d8b030d518f69b21766" => :yosemite
|
|
|
|
sha256 "5bc9ab2b8ecb14048115c876bf77a7490139715d3250407785159aa2b72faf8f" => :mavericks
|
|
|
|
sha256 "da53aea34a10ecba854eb3f65b451e99fa4dbe5134261ef2deadff8266ff49e2" => :mountain_lion
|
2014-10-13 15:15:07 +00:00
|
|
|
end
|
|
|
|
|
2014-10-13 05:29:42 +00:00
|
|
|
depends_on "go" => :build
|
|
|
|
|
|
|
|
# required by gox
|
|
|
|
go_resource "github.com/mitchellh/iochan" do
|
|
|
|
url "https://github.com/mitchellh/iochan.git",
|
|
|
|
:revision => "b584a329b193e206025682ae6c10cdbe03b0cd77"
|
|
|
|
end
|
|
|
|
|
|
|
|
go_resource "github.com/mitchellh/gox" do
|
2015-03-31 21:38:02 +00:00
|
|
|
url "https://github.com/mitchellh/gox.git",
|
|
|
|
:tag => "v0.3.0", :revision => "54b619477e8932bbb6314644c867e7e6db7a9c71"
|
2014-10-13 05:29:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
# discovered via
|
2014-10-19 11:45:39 +00:00
|
|
|
# find . -name "*.go" -exec head -20 "{}" ";" | grep ".*\..*/" | sort | uniq
|
2014-10-13 05:29:42 +00:00
|
|
|
go_resource "github.com/fatih/color" do
|
2015-03-31 21:38:02 +00:00
|
|
|
url "https://github.com/fatih/color.git",
|
2015-05-05 22:55:39 +00:00
|
|
|
:revision => "b8f08a5598ffe40b0e3f45d483d3cfe3c1dc4964"
|
2015-03-31 21:38:02 +00:00
|
|
|
end
|
|
|
|
go_resource "github.com/shiena/ansicolor" do
|
|
|
|
url "https://github.com/shiena/ansicolor.git",
|
|
|
|
:revision => "8368d3b31cf6f2c2464c7a91675342c9a0ac6658"
|
2014-10-13 05:29:42 +00:00
|
|
|
end
|
|
|
|
go_resource "github.com/mattn/go-colorable" do
|
2015-03-31 21:38:02 +00:00
|
|
|
url "https://github.com/mattn/go-colorable.git",
|
|
|
|
:revision => "d67e0b7d1797975196499f79bcc322c08b9f218b"
|
2014-10-13 05:29:42 +00:00
|
|
|
end
|
2015-03-31 21:38:02 +00:00
|
|
|
go_resource "golang.org/x/net" do
|
|
|
|
url "https://go.googlesource.com/net.git",
|
2015-05-05 22:55:39 +00:00
|
|
|
:revision => "a8c61998a557a37435f719980da368469c10bfed"
|
2014-10-13 05:29:42 +00:00
|
|
|
end
|
2015-03-31 21:38:02 +00:00
|
|
|
go_resource "golang.org/x/text" do
|
|
|
|
url "https://go.googlesource.com/text.git",
|
2015-05-05 22:55:39 +00:00
|
|
|
:revision => "cee5b80e82c1d078cfdbe853beb9c8318c593677"
|
2014-10-13 05:29:42 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
|
|
|
# For the gox buildtool
|
|
|
|
ENV.append_path "PATH", buildpath
|
|
|
|
|
|
|
|
# fake our install so gox will see it
|
2014-10-19 11:45:39 +00:00
|
|
|
repo_dir = homepage.downcase.gsub /^https:../, ""
|
2014-10-13 05:29:42 +00:00
|
|
|
my_pkg = buildpath / "src/#{repo_dir}"
|
2014-10-19 11:45:39 +00:00
|
|
|
prefix.install "LICENSE"
|
2014-10-13 05:29:42 +00:00
|
|
|
my_pkg.install Dir["*"]
|
|
|
|
|
2015-05-05 22:55:39 +00:00
|
|
|
Language::Go.stage_deps resources, buildpath/"src"
|
2014-10-13 05:29:42 +00:00
|
|
|
|
|
|
|
ENV["GOPATH"] = buildpath
|
|
|
|
cd "src/github.com/mitchellh/gox" do
|
|
|
|
system "go", "build"
|
|
|
|
buildpath.install "gox"
|
|
|
|
end
|
|
|
|
|
|
|
|
cd my_pkg do
|
|
|
|
mkdir "bin"
|
|
|
|
arch = MacOS.prefer_64_bit? ? "amd64" : "386"
|
|
|
|
system "gox", "-arch", arch,
|
|
|
|
"-os", "darwin",
|
|
|
|
"-output", "bin/pup-{{.Dir}}",
|
|
|
|
"./..."
|
|
|
|
bin.install "bin/pup-pup" => "pup"
|
|
|
|
# regrettably, there is no manual :-(
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
2015-05-05 22:55:39 +00:00
|
|
|
expected = "Hello"
|
|
|
|
actual = pipe_output("pup p \"text{}\"", "<body><p>Hello</p></body>").strip
|
2014-10-13 05:29:42 +00:00
|
|
|
assert_equal expected, actual
|
|
|
|
end
|
|
|
|
end
|