# $Id: PKGBUILD 113806 2014-06-30 17:51:30Z dwallace $
# Maintainer: Daniel Wallace <danielwallace at gtmanfred dot com>
# Contributor: Alfredo Palhares <masterkorp@masterkorp.net>

pkgname=hub
_pkgdir=github-hub-
pkgver=1.12.1
pkgrel=1
pkgdesc="cli interface for Github"
arch=('any')
url="http://defunkt.io/hub"
depends=('git' 'ruby')
license=('MIT')
source=("$pkgname-$pkgver.tar.gz::https://github.com/defunkt/hub/tarball/v$pkgver")
sha256sums=('7f0d0b9711fd594f00c8ede80c1cf2e3bed515327b8902ea1f4dfbdac90884d4')

build() {
  cd "$srcdir/$_pkgdir"*

  rake standalone
  gzip --best -c man/hub.1> hub.1.gz

}

package() {
  cd "$srcdir/$_pkgdir"*

  install -Dm755 "$srcdir/$_pkgdir"*"/$pkgname" "$pkgdir/usr/bin/$pkgname"

  install -d "$pkgdir/usr/share/$pkgname"
  cp -dpr --no-preserve=ownership "$srcdir/$_pkgdir"*"/git-hooks" "$pkgdir/usr/share/$pkgname/git-hooks"

  install -Dm644 "$srcdir/$_pkgdir"*"/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  install -Dm644 "$srcdir/$_pkgdir"*"/etc/hub.bash_completion.sh" "$pkgdir/usr/share/bash-completion/completions/hub"
  install -Dm644 "$srcdir/$_pkgdir"*"/etc/hub.zsh_completion" "$pkgdir/usr/share/zsh/site-functions/_hub"

  install -Dm644 "$srcdir/$_pkgdir"*"/man/$pkgname.1" "$pkgdir/usr/share/man/man1/$pkgname.1"

}
