2014-10-13 05:29:42 +00:00
|
|
|
require "language/go"
|
|
|
|
|
|
|
|
class Pup < Formula
|
|
|
|
homepage "https://github.com/EricChiang/pup"
|
2015-03-31 21:38:02 +00:00
|
|
|
url "https://github.com/ericchiang/pup/archive/v0.3.8.tar.gz"
|
|
|
|
sha256 "8cf911f9ff5ddc5138ab86ce58f93f468e233e78782ca0dc985d5e3485c4c8d6"
|
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-02-20 15:37:41 +00:00
|
|
|
cellar :any
|
2015-03-31 23:45:10 +00:00
|
|
|
sha256 "df4845eacaf13a885015266fa87b282b99cec7d59d216a0d5f0ded35dcfb8ea6" => :yosemite
|
|
|
|
sha256 "a7013f00f515a8e2f5c290d5b540ed7356504ba1843149782e1cf2d89aabcf13" => :mavericks
|
|
|
|
sha256 "0ecbecac78ddb4b50b4b6d1caf24524d3751d8e0348411e767253fc694546e0c" => :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",
|
2014-10-13 05:29:42 +00:00
|
|
|
# this was just the `master` at the time of this Formula
|
2015-03-31 21:38:02 +00:00
|
|
|
:revision => "1b4171c5cdb770e90ab04e960b52f43b583d398c"
|
|
|
|
end
|
|
|
|
go_resource "github.com/shiena/ansicolor" do
|
|
|
|
url "https://github.com/shiena/ansicolor.git",
|
|
|
|
# this was just the `master` at the time of this Formula
|
|
|
|
: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",
|
2014-10-13 05:29:42 +00:00
|
|
|
# this was just the `master` at the time of this Formula
|
2015-03-31 21:38:02 +00:00
|
|
|
: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",
|
|
|
|
# this was just the `master` at the time of this Formula
|
|
|
|
:revision => "7dbad50ab5b31073856416cdcfeb2796d682f844"
|
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",
|
|
|
|
# this was just the `tip` at the time of this Formula
|
|
|
|
:revision => "a9f4d1a427d033e4320e1c1639b87e41bd310cce"
|
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["*"]
|
|
|
|
|
2014-10-19 11:45: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-03-31 21:38:02 +00:00
|
|
|
expected = %(Hello)
|
|
|
|
actual = %x(echo "<body><p>Hello</p></body>" | pup p "text{}").strip
|
2014-10-13 05:29:42 +00:00
|
|
|
assert_equal expected, actual
|
|
|
|
end
|
|
|
|
end
|