homebrew-core/Formula/hub.rb
2018-12-11 19:48:53 +08:00

50 lines
1.7 KiB
Ruby

class Hub < Formula
desc "Add GitHub support to git on the command-line"
homepage "https://hub.github.com/"
url "https://github.com/github/hub/archive/v2.6.1.tar.gz"
sha256 "3a78f7fc8a024cc232463c664fecf0b49574f5205a49f2320886763c136ac000"
head "https://github.com/github/hub.git"
bottle do
cellar :any_skip_relocation
sha256 "0d815d2e910900ed41961a7923a60ee1fe7f6a5937b2b9463b5aa6cad4fc1c48" => :mojave
sha256 "318bf3aa0ef13748341f35888b06766ea988e3a9fd368c9118449e67c490cb3b" => :high_sierra
sha256 "8ea6fddfc8c73fe6312aa2f0dd4c4a2f70abcd87457aba8d4c0559386245257b" => :sierra
end
depends_on "go" => :build
# System Ruby uses old TLS versions no longer supported by RubyGems.
depends_on "ruby" => :build if MacOS.version <= :sierra
def install
ENV["GOPATH"] = buildpath
(buildpath/"src/github.com/github/hub").install buildpath.children
cd "src/github.com/github/hub" do
begin
deleted = ENV.delete "SDKROOT"
ENV["GEM_HOME"] = buildpath/"gem_home"
system "gem", "install", "bundler"
ENV.prepend_path "PATH", buildpath/"gem_home/bin"
system "make", "man-pages"
ensure
ENV["SDKROOT"] = deleted
end
system "make", "install", "prefix=#{prefix}"
prefix.install_metafiles
bash_completion.install "etc/hub.bash_completion.sh"
zsh_completion.install "etc/hub.zsh_completion" => "_hub"
fish_completion.install "etc/hub.fish_completion" => "hub.fish"
end
end
test do
system "git", "init"
%w[haunted house].each { |f| touch testpath/f }
system "git", "add", "haunted", "house"
system "git", "commit", "-a", "-m", "Initial Commit"
assert_equal "haunted\nhouse", shell_output("#{bin}/hub ls-files").strip
end
end