pup 0.4.0
- upstream now uses the vendor directory - clean up the formula Closes #3247. Signed-off-by: ilovezfs <ilovezfs@icloud.com>
This commit is contained in:
parent
44fa8ac8f7
commit
d166f93d56
1 changed files with 16 additions and 54 deletions
|
@ -3,9 +3,8 @@ require "language/go"
|
|||
class Pup < Formula
|
||||
desc "Parse HTML at the command-line"
|
||||
homepage "https://github.com/EricChiang/pup"
|
||||
url "https://github.com/ericchiang/pup/archive/v0.3.9.tar.gz"
|
||||
sha256 "5e59805edf84d73b2b4c58fe5aeb9a12fc70c028b4aaf58ded6b91ff418b0dda"
|
||||
|
||||
url "https://github.com/ericchiang/pup/archive/v0.4.0.tar.gz"
|
||||
sha256 "0d546ab78588e07e1601007772d83795495aa329b19bd1c3cde589ddb1c538b0"
|
||||
head "https://github.com/EricChiang/pup.git"
|
||||
|
||||
bottle do
|
||||
|
@ -18,73 +17,36 @@ class Pup < Formula
|
|||
|
||||
depends_on "go" => :build
|
||||
|
||||
# required by gox
|
||||
go_resource "github.com/mitchellh/iochan" do
|
||||
url "https://github.com/mitchellh/iochan.git",
|
||||
:revision => "b584a329b193e206025682ae6c10cdbe03b0cd77"
|
||||
:revision => "87b45ffd0e9581375c491fef3d32130bb15c5bd7"
|
||||
end
|
||||
|
||||
go_resource "github.com/mitchellh/gox" do
|
||||
url "https://github.com/mitchellh/gox.git",
|
||||
:tag => "v0.3.0", :revision => "54b619477e8932bbb6314644c867e7e6db7a9c71"
|
||||
end
|
||||
|
||||
# discovered via
|
||||
# find . -name "*.go" -exec head -20 "{}" ";" | grep ".*\..*/" | sort | uniq
|
||||
go_resource "github.com/fatih/color" do
|
||||
url "https://github.com/fatih/color.git",
|
||||
:revision => "b8f08a5598ffe40b0e3f45d483d3cfe3c1dc4964"
|
||||
end
|
||||
go_resource "github.com/shiena/ansicolor" do
|
||||
url "https://github.com/shiena/ansicolor.git",
|
||||
:revision => "8368d3b31cf6f2c2464c7a91675342c9a0ac6658"
|
||||
end
|
||||
go_resource "github.com/mattn/go-colorable" do
|
||||
url "https://github.com/mattn/go-colorable.git",
|
||||
:revision => "d67e0b7d1797975196499f79bcc322c08b9f218b"
|
||||
end
|
||||
go_resource "golang.org/x/net" do
|
||||
url "https://go.googlesource.com/net.git",
|
||||
:revision => "a8c61998a557a37435f719980da368469c10bfed"
|
||||
end
|
||||
go_resource "golang.org/x/text" do
|
||||
url "https://go.googlesource.com/text.git",
|
||||
:revision => "cee5b80e82c1d078cfdbe853beb9c8318c593677"
|
||||
:revision => "6e9ee79eab7bb1b84155379b3f94ff9a87b344e4"
|
||||
end
|
||||
|
||||
def install
|
||||
# For the gox buildtool
|
||||
ENV.append_path "PATH", buildpath
|
||||
|
||||
# fake our install so gox will see it
|
||||
repo_dir = homepage.downcase.gsub /^https:../, ""
|
||||
my_pkg = buildpath / "src/#{repo_dir}"
|
||||
prefix.install "LICENSE"
|
||||
my_pkg.install Dir["*"]
|
||||
ENV["GOPATH"] = buildpath
|
||||
dir = buildpath/"src/github.com/ericchiang/pup"
|
||||
dir.install buildpath.children
|
||||
|
||||
Language::Go.stage_deps resources, buildpath/"src"
|
||||
ENV.prepend_create_path "PATH", buildpath/"bin"
|
||||
cd("src/github.com/mitchellh/gox") { system "go", "install" }
|
||||
|
||||
ENV["GOPATH"] = buildpath
|
||||
cd "src/github.com/mitchellh/gox" do
|
||||
system "go", "build"
|
||||
buildpath.install "gox"
|
||||
end
|
||||
|
||||
cd my_pkg do
|
||||
mkdir "bin"
|
||||
cd dir do
|
||||
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 :-(
|
||||
system "gox", "-arch", arch, "-os", "darwin", "./..."
|
||||
bin.install "pup_darwin_#{arch}" => "pup"
|
||||
end
|
||||
|
||||
prefix.install_metafiles dir
|
||||
end
|
||||
|
||||
test do
|
||||
expected = "Hello"
|
||||
actual = pipe_output("pup p \"text{}\"", "<body><p>Hello</p></body>").strip
|
||||
assert_equal expected, actual
|
||||
output = pipe_output("#{bin}/pup p text{}", "<body><p>Hello</p></body>", 0)
|
||||
assert_equal "Hello", output.chomp
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue