# Generated by gem2arch (https://github.com/anatol/gem2arch)
# Contributor (AUR): Nicolas Bigaouette <nbigaouette@chemcomp.com>
# Maintainer (AUR): Nick Østergaard <oe.nick at gmail dot com>

_gemname=asciidoctor
pkgname=ruby-$_gemname
pkgver=1.5.8
pkgdesc='An implementation of the AsciiDoc text processor and publishing toolchain in Ruby'
url='http://asciidoctor.org'
license=(MIT)

pkgrel=1
arch=(any)
depends=(ruby)
makedepends=(rubygems)
options=(!emptydirs)
source=($pkgname-$pkgver.tar.gz::https://github.com/asciidoctor/asciidoctor/archive/v$pkgver.tar.gz)
sha256sums=('bc225145feb7876bce5188aa3ef511fad49b141ec18e1bb60e69b33b0a100da0')

build() {
  cd "$srcdir/$_gemname-$pkgver"

  gem build $_gemname.gemspec
}

package() {
  cd "$srcdir/$_gemname-$pkgver"

  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"

  install -Dm644 "$pkgdir$_gemdir"/gems/$_gemname-$pkgver/LICENSE \
                 "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
