# $Id: PKGBUILD 126045 2015-01-17 18:58:19Z dwallace $
# Maintainer: Daniel Wallace <danielwallace at gtmanfred dot com>
# Contributor: Alfredo Palhares <masterkorp@masterkorp.net>

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

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"

}
