# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=ruby-kramdown-parser-gfm
_gemname=kramdown-parser-gfm
pkgver=1.1.0
# Release 1.1.0 is not tagged in git. This revision also includes fixes
# in tests. See https://github.com/kramdown/parser-gfm/issues/15.
_gitrev=a3f87b9e216973ee5c224b2db35637cca2591db1
pkgrel=4
pkgdesc="A kramdown parser for the GFM dialect of Markdown"
url="https://github.com/kramdown/parser-gfm"
arch="noarch"
license="MIT"
depends="ruby ruby-kramdown~=2"
checkdepends="ruby-minitest ruby-rouge"
makedepends="ruby-rake"
source="https://github.com/kramdown/parser-gfm/archive/$_gitrev/$pkgname-$_gitrev.tar.gz
	fix-version.patch
	gemspec.patch
	"
builddir="$srcdir/parser-gfm-$_gitrev"
# fails a comparison now
options="!check"

build() {
	rake gemspec
	gem build $_gemname.gemspec
}

check() {
	rake test
}

package() {
	local gemdir="$pkgdir/$(ruby -e 'puts Gem.default_dir')"
	local geminstdir="$gemdir/gems/$_gemname-$pkgver"

	gem install \
		--local \
		--install-dir "$gemdir" \
		--ignore-dependencies \
		--no-document \
		--verbose \
		$_gemname

	# Remove unnecessary files and rubbish...
	cd "$gemdir"
	rm -r cache build_info doc extensions
}

sha512sums="
dfe53da776465a9ba7d19bc1ca081e4af1f8f8f42077a17ac4d2c34a8125b92a488e5106cd887ad06a4766606ee58afdd8572ce1b41fb447f30048c719d4d1de  ruby-kramdown-parser-gfm-a3f87b9e216973ee5c224b2db35637cca2591db1.tar.gz
0300c7a2781a0561ca2c026a33f5ea5d8010fac80a5770d45c7f8e95b37914264dbfd7fb9c9aac833cbab1e235e6382e4bf5536b0330bfebac463b3089fb865e  fix-version.patch
8ba8d80f606f5e0ccce2e8433c47ef21f711760ec8a365de242468dca4bcf0febdb6d87f1a65abd2654f523eb150d54312a47deeb27fc94ab35c04216e48c30a  gemspec.patch
"
