_gemname=yajl-ruby
pkgname=ruby-$_gemname
pkgver=1.4.1
pkgrel=2
pkgdesc='C binding to the excellent YAJL JSON parsing and generation library'
arch=(x86_64)
url='https://github.com/brianmario/yajl-ruby'
license=(MIT)
depends=(ruby)
options=(!emptydirs)
source=(https://rubygems.org/downloads/$_gemname-$pkgver.gem)
noextract=($_gemname-$pkgver.gem)
sha1sums=('04d0aa7b51a015bd9b3383d4d561fd9067981f76')

package() {
  local _gemdir="$(ruby -e'puts Gem.default_dir')"
  gem install --ignore-dependencies --no-user-install --no-document -i "$pkgdir/$_gemdir" -n "$pkgdir/usr/bin" $_gemname-$pkgver.gem
  rm "$pkgdir/$_gemdir/cache/$_gemname-$pkgver.gem"
  rm -r "$pkgdir/$_gemdir/gems/$_gemname-$pkgver/ext"
  install -D -m644 "$pkgdir/$_gemdir/gems/$_gemname-$pkgver/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
#  find "$pkgdir/$_gemdir/extensions/" -name *.so -delete
#  rm -r "$pkgdir/$_gemdir/gems/$_gemname-$pkgver/test"
#  install -D -m644 "$pkgdir/$_gemdir/gems/$_gemname-$pkgver/COPYING" "$pkgdir/usr/share/licenses/$pkgname/COPYING"

}