gh.rb 828 字节
Newer Older
J
Jingwen Owen Ou 已提交
1
require "formula"
J
Jingwen Owen Ou 已提交
2 3

class Gh < Formula
J
Jingwen Owen Ou 已提交
4
  VERSION = "0.19.2"
J
Jingwen Owen Ou 已提交
5
  ARCH = if MacOS.prefer_64_bit?
J
Jingwen Owen Ou 已提交
6
           "amd64"
J
Jingwen Owen Ou 已提交
7
         else
J
Jingwen Owen Ou 已提交
8
           "386"
J
Jingwen Owen Ou 已提交
9
         end
J
Jingwen Owen Ou 已提交
10

J
Jingwen Owen Ou 已提交
11 12
  homepage "https://github.com/jingweno/gh"
  head "https://github.com/jingweno/gh.git"
13
  url "https://github.com/jingweno/gh/releases/download/v#{VERSION}/gh_#{VERSION}-snapshot_darwin_#{ARCH}.tar.gz"
J
Jingwen Owen Ou 已提交
14
  version VERSION
J
Jingwen Owen Ou 已提交
15 16

  def install
J
Jingwen Owen Ou 已提交
17
    bin.install "gh"
J
Jingwen Owen Ou 已提交
18 19
    bash_completion.install "etc/gh.bash_completion.sh"
    zsh_completion.install "etc/gh.zsh_completion" => "_gh"
J
Jingwen Owen Ou 已提交
20 21
  end

22 23 24 25 26 27 28
  def caveats; <<-EOS.undent
  To upgrade gh, run `brew upgrade https://raw.github.com/jingweno/gh/master/homebrew/gh.rb`

  More information here: https://github.com/jingweno/gh/blob/master/README.md
    EOS
  end

J
Jingwen Owen Ou 已提交
29
  test do
J
Jingwen Owen Ou 已提交
30
    assert_equal VERSION, `#{bin}/gh version`.split.last
J
Jingwen Owen Ou 已提交
31 32
  end
end