# Maintainer: George Rawlinson <grawlinson@archlinux.org>
# Contributor: Joel Goguen <contact+aur@jgoguen.ca>
# Contributor: Christopher Loen <christopherloen at gmail dot com>
# Contributor: Artem Vorotnikov <artem@vorotnikov.me>

pkgname=ruby-mixlib-shellout
_pkgname="${pkgname#ruby-}"
pkgver=3.4.9
pkgrel=1
pkgdesc='Run external commands on Unix'
arch=(any)
url='https://github.com/chef/mixlib-shellout'
license=(Apache-2.0)
depends=(ruby ruby-chef-utils)
makedepends=(git ruby-rake ruby-rdoc)
options=(!emptydirs)
source=("$pkgname::git+$url#tag=v$pkgver")
sha512sums=('c4a452a8fcbd18a305623dccc95330ef6a389bff2ecf55291dc7eef72d93d6df14e1eb4e8a2d7f2cf1a7a15308c83c83f8c6cfb54448ffa625ff21d74be5367d')
b2sums=('e9ead8d9cf20d87091d98dfdae0c49414e541a8ba9acb16b85506a9353b7124e7fa1a66ee0c4a4cf2c88cdd763d6b107a71e8a4d748f641f021f284160a4f0b8')

build() {
  cd "$pkgname"

  gem build "$_pkgname.gemspec"
}

package() {
  cd "$pkgname"

  local _gemdir="$(gem env gemdir)"

    #--no-document \
  gem install \
    --local \
    --verbose \
    --ignore-dependencies \
    --no-user-install \
    --install-dir "$pkgdir/$_gemdir" \
    --bindir "$pkgdir/usr/bin" \
    "$_pkgname-$pkgver.gem"

  # delete cache
  rm -vrf "$pkgdir/$_gemdir/cache"
}
