# Contributor: Jochen Schalanda <jochen+aur@schalanda.name>
# Maintainer : Parabola GNU / Linux-libre Aurelien Desbrieres <aurelien@cwb.IO>

_gemname=hiera-json
pkgname=ruby-$_gemname
pkgver=0.4.0
pkgrel=1
pkgdesc='Store Hiera data in JSON'
arch=(any)
url='http://projects.puppetlabs.com/projects/hiera/'
license=('MIT')
depends=('ruby')
makedepends=('rubygems' 'ruby-hiera')
source=(http://gems.rubyforge.org/gems/$_gemname-$pkgver.gem)
noextract=($_gemname-$pkgver.gem)

package() {
  cd "$srcdir"
  # _gemdir is defined inside package() because if ruby[gems] is not installed on
  # the system, makepkg will exit with an error when sourcing the PKGBUILD.
  local _gemdir="$(ruby -rubygems -e'puts Gem.default_dir')"

  gem install --no-user-install --ignore-dependencies -i "$pkgdir$_gemdir" \
    -n "$pkgdir/usr/bin" "$_gemname-$pkgver.gem"
}