# Contributor: Seung Soo Mun <hamletmun@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=asciidoctor
pkgver=2.0.23
pkgrel=0
pkgdesc="Converter for AsciiDoc to HTML5, DocBook 5 (or 4.5) and other formats"
url="https://rubygems.org/gems/asciidoctor"
arch="noarch"
license="MIT"
options="!check"
depends="ruby"
source="https://rubygems.org/downloads/asciidoctor-$pkgver.gem"

package() {
	local gemdir="$(ruby -e 'puts Gem.default_dir')"

	gem install \
		--local \
		--install-dir "$pkgdir"/$gemdir \
		--ignore-dependencies \
		--verbose \
		--no-document \
		"$srcdir"/$pkgname-$pkgver.gem

	rm -rf "$pkgdir"/$gemdir/cache

	cd "$pkgdir"
	local i; for i in usr/lib/ruby/gems/*/bin/*; do
		if [ -e "$i" ]; then
			mkdir -p "$pkgdir"/usr/bin
			ln -s /$i "$pkgdir"/usr/bin/
		fi
	done
}

sha512sums="
61aeb0c78438b61cdd7caf31840c82fc68d94ed296e381927c1e3a0b36be5bc29a025a7d9a076c19293f1c8b69056120f0493456106eeeb4a083afb59a414328  asciidoctor-2.0.23.gem
"
