homebrew-core/Formula/ghq.rb
2015-08-04 08:59:34 -07:00

56 lines
1.9 KiB
Ruby

require "language/go"
class Ghq < Formula
desc "Remote repository management made easy"
homepage "https://github.com/motemen/ghq"
url "https://github.com/motemen/ghq/archive/v0.7.tar.gz"
sha256 "ed71e44d35440236d13b85a176ad352d38f6a22f6de55800c3f6a275030f8123"
head "https://github.com/motemen/ghq.git"
bottle do
cellar :any
sha256 "cc9970bbbea096ed290fa88eef327ac552c016c2b1db7d8a7376ffe17538317b" => :yosemite
sha256 "dc69157c78931f46074f5456ceb03c1e31f4d96e46ed69dfafb94db80e24dd2c" => :mavericks
sha256 "4dbdf8bb2462ddd5ec2f9ecfe37982b25759a19a8ea5d5f8e06fb5fe0dff6a7a" => :mountain_lion
end
option "without-completions", "Disable zsh completions"
depends_on "go" => :build
go_resource "github.com/codegangsta/cli" do
url "https://github.com/codegangsta/cli.git", :revision => "565493f259bf868adb54d45d5f4c68d405117adf"
end
go_resource "github.com/mitchellh/go-homedir" do
url "https://github.com/mitchellh/go-homedir.git", :revision => "1f6da4a72e57d4e7edd4a7295a585e0a3999a2d4"
end
go_resource "github.com/motemen/go-colorine" do
url "https://github.com/motemen/go-colorine.git", :revision => "49ff36b8fa42db28092361cd20dcefd0b03b1472"
end
go_resource "github.com/daviddengcn/go-colortext" do
url "https://github.com/daviddengcn/go-colortext.git", :revision => "13eaeb896f5985a1ab74ddea58707a73d875ba57"
end
def install
mkdir_p "#{buildpath}/src/github.com/motemen/"
ln_s buildpath, "#{buildpath}/src/github.com/motemen/ghq"
ENV["GOPATH"] = buildpath
ENV.append_path "PATH", "#{ENV["GOPATH"]}/bin"
Language::Go.stage_deps resources, buildpath/"src"
system "go", "build", "-ldflags", "-X main.Version #{version}", "-o", "ghq"
bin.install "ghq"
if build.with? "completions"
zsh_completion.install "zsh/_ghq"
end
end
test do
assert_match "#{testpath}/.ghq", shell_output("#{bin}/ghq root")
end
end