aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/hub.rb
blob: 0b7a4966faf0eeb4eb8814aea93ff0e1eb24d205 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require 'formula'

class Hub < Formula
  homepage 'http://hub.github.com/'
  url 'https://github.com/github/hub/archive/v1.12.2.tar.gz'
  sha1 '65359d3dcc8e1a0986aab3726f6047bfb9df3d7c'

  head do
    url "https://github.com/github/hub.git", :branch => "master"
    depends_on "go" => :build
  end

  option 'without-completions', 'Disable bash/zsh completions'

  def install
    if build.head?
      system "script/build"
      bin.install "hub"
    else
      rake "install", "prefix=#{prefix}"
    end

    if build.with? 'completions'
      bash_completion.install 'etc/hub.bash_completion.sh'
      zsh_completion.install 'etc/hub.zsh_completion' => '_hub'
    end
  end

  test do
    HOMEBREW_REPOSITORY.cd do
      assert_equal "bin/brew", shell_output("#{bin}/hub ls-files -- bin").strip
    end
  end
end